Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / ACE / apps / JAWS2 / JAWS / Reaper.cpp
blobca928fea6c5178a0ede4c8e7597288c6f2db2953
1 #include "JAWS/Reaper.h"
2 #include "JAWS/Concurrency.h"
3 #include "JAWS/IO_Acceptor.h"
6 JAWS_Reaper::JAWS_Reaper (JAWS_Concurrency_Base *concurrency)
7 : concurrency_ (concurrency),
8 waiting_ (0)
12 JAWS_Reaper::~JAWS_Reaper ()
16 int
17 JAWS_Reaper::open (void *)
19 if (this->waiting_ == 0)
21 ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, g ,this->lock_, -1);
22 if (this->waiting_ == 0)
24 if (this->activate () == -1)
25 ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "JAWS_Reaper::activate"),
26 -1);
27 this->waiting_ = 1;
30 return 0;
33 int
34 JAWS_Reaper::svc ()
36 ACE_TRACE ("JAWS_Reaper::svc");
37 int result = this->concurrency_->thr_mgr ()->wait ();
38 JAWS_IO_Synch_Acceptor_Singleton::instance ()->close ();
39 JAWS_IO_Asynch_Acceptor_Singleton::instance ()->close ();
40 ACE_DEBUG ((LM_DEBUG, "(%t) Leaving REAPER\n"));
41 return result;