Main Page   Packages   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Search  

C:/temp/src/j2k/QNX4/MsgThread.hpp

Go to the documentation of this file.
00001 #ifndef __J2K__MsgThread_HPP__
00002 #define __J2K__MsgThread_HPP__
00003 
00004 #include <j2k/Fred/QNX/Thread.hpp>
00005 #include <j2k/Fred/QNX/MsgData.hpp>
00006 
00007 // Increase this if a message is bigger than 1 KB !
00008 #define MSG_BUFFER_MAX  1024
00009 
00010 /*  Example of Sorting and dispatching function:
00011 MsgData* SortMsg( MsgData* msg, MsgThread* mySelf, pid_t myPid ) {
00012    void* ( MsgThreadChild::*Table[] )( void* ) = { 
00013       MsgThreadChild::fn1, 
00014       MsgThreadChild::fn2 
00015    };
00016 }
00017 */
00018 
00019 // A Thread that deals with basic Message stuff
00020 class MsgThread : public Thread
00021 {
00022 private:
00023    serial_t  Serialization;   // SHOULDN'T BE MODIFIED ELSE WHERE.
00024 
00025 public:
00026    MsgThread() : Serialization( MSG_THREAD_SERIAL ) { }
00027 
00028    virtual ~MsgThread() { MsgThread::Stop(); }
00029 
00030    // Implemented.
00031    virtual void Run();
00032 
00033    virtual MsgData* SortMsg(  MsgData* msg, MsgThread* mySelf, pid_t myPid ) = 0;
00034    virtual MsgData* Dispatch( MsgData* msg, MsgThread* mySelf, pid_t myPid ) = 0;
00035 
00036    // The only thing that should be implemented in MsgThreadChild
00037    virtual void* MsgDispatcher( void* msg, pid_t replyPid ) = 0;
00038 
00039    void Stop();
00040 
00041    // Simpler Send(...) command
00042    void SendMsg( void* incomming, void* reply );
00043 };
00044 
00045 #endif

Generated on Sun Oct 14 18:46:36 2001 for Standard J2K Library by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001