reac_thread.cpp

00001 // "reac_thread.cpp"
00002 
00003 // (c) OPAC Team, LIFL, August 2005
00004 
00005 /* 
00006    Contact: paradiseo-help@lists.gforge.inria.fr
00007 */
00008 
00009 #include "reac_thread.h"
00010 
00011 static bool the_end = false;
00012 
00013 static std :: vector <ReactiveThread *> reac_threads;
00014 
00015 ReactiveThread :: ReactiveThread () {
00016 
00017   reac_threads.push_back (this);
00018   sem_init (& sem, 0, 0);
00019 }
00020 
00021 void ReactiveThread :: sleep () {
00022 
00023   sem_wait (& sem);     
00024 }
00025 
00026 void ReactiveThread :: wakeUp () {
00027 
00028   sem_post (& sem);     
00029 }
00030 
00031 void stopReactiveThreads () {
00032 
00033   the_end = true;
00034   for (unsigned i = 0; i < reac_threads.size (); i ++)
00035     reac_threads [i] -> wakeUp  ();     
00036 }

Generated on Tue Jan 9 15:47:38 2007 for ParadisEO-PEO by  doxygen 1.4.7