1 #ifndef __WorkItem 2 #define __WorkItem 3 4 #include <list> 5 #include "windows.h" 6 7 extern "C" { 8 #include "ccs_pipe.h" 9 } 10 11 class WorkItem { 12 private: 13 k5_ipc_stream _buf; 14 WIN_PIPE* _pipe; 15 const long _rpcmsg; 16 const long _sst; 17 public: 18 WorkItem( k5_ipc_stream buf, 19 WIN_PIPE* pipe, 20 const long type, 21 const long serverStartTime); 22 WorkItem( const WorkItem&); 23 WorkItem(); 24 ~WorkItem(); 25 payload()26 const k5_ipc_stream payload() const {return _buf;} 27 const k5_ipc_stream take_payload(); 28 WIN_PIPE* take_pipe(); pipe()29 WIN_PIPE* pipe() const {return _pipe;} type()30 const long type() const {return _rpcmsg;} sst()31 const long sst() const {return _sst;} 32 char* print(char* buf); 33 }; 34 35 class WorkList { 36 private: 37 std::list <WorkItem*> wl; 38 CRITICAL_SECTION cs; 39 HANDLE hEvent; 40 public: 41 WorkList(); 42 ~WorkList(); 43 int initialize(); 44 int cleanup(); 45 void wait(); 46 int add(WorkItem*); 47 int remove(WorkItem**); isEmpty()48 bool isEmpty() {return wl.empty();} 49 }; 50 51 #endif // __WorkItem 52