communicable.h

00001 // "communicable.h"
00002 
00003 // (c) OPAC Team, LIFL, August 2005
00004 
00005 /* 
00006    Contact: paradiseo-help@lists.gforge.inria.fr
00007 */
00008 
00009 #ifndef __communicable_h
00010 #define __communicable_h
00011 
00012 #include <semaphore.h>
00013 
00014 typedef unsigned COMM_ID;
00015 
00016 class Communicable {
00017 
00018 public :
00019 
00020   Communicable ();
00021   
00022   virtual ~ Communicable ();
00023 
00024   COMM_ID getKey ();  
00025 
00026   void lock (); /* It suspends the current process if the semaphore is locked */
00027   void unlock (); /* It unlocks the shared semaphore */
00028 
00029   void stop (); /* It suspends the current process */
00030   void resume (); /* It resumes ___________ */
00031   
00032 protected :
00033 
00034   COMM_ID key;
00035 
00036   sem_t sem_lock;
00037   
00038   sem_t sem_stop;
00039 
00040   static unsigned num_comm;
00041 };
00042 
00043 extern Communicable * getCommunicable (COMM_ID __key); 
00044 
00045 //extern COMM_ID getKey (const Communicable * __comm);
00046 
00047 #endif

Generated on Thu Jul 5 13:43:30 2007 for ParadisEO-PEO by  doxygen 1.4.7