"Fossies" - the Fresh Open Source Software Archive

Member "bonnie++-1.04/forkit.h" (13 Oct 2002, 761 Bytes) of package /linux/privat/bonnie++_1.04.tgz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "forkit.h" see the Fossies "Dox" file reference documentation.

    1 #ifndef FORKIT_H
    2 #define FORKIT_H
    3 
    4 #ifndef OS2
    5 #include <poll.h>
    6 #endif
    7 
    8 #include "port.h"
    9 
   10 class Fork;
   11 
   12 typedef void *PVOID;
   13 
   14 typedef void(* FUNCTION)(Fork *, PVOID, int);
   15 
   16 typedef struct
   17 {
   18   FILE_TYPE child_read, child_write;
   19   Fork *f;
   20   PVOID param;
   21   FUNCTION func;
   22   int threadNum;
   23 } THREAD_DATA;
   24 
   25 class Fork
   26 {
   27 public:
   28   Fork();
   29   void go(FUNCTION func, PVOID param, int num);
   30 
   31 
   32   int Read(PVOID buf, int size, int timeout = 60);
   33   int Write(PVOID buf, int size, int timeout = 60);
   34 
   35   void startit(THREAD_DATA *td); // free td when finished
   36 
   37   int wait();
   38 
   39   int getNumThreads() const { return m_numThreads; }
   40 
   41 private:
   42 #ifndef OS2
   43   pollfd m_readPoll;
   44   pollfd m_writePoll;
   45 #endif
   46   FILE_TYPE m_read;
   47   FILE_TYPE m_write;
   48   int m_numThreads;
   49 };
   50 
   51 #endif
   52