summaryrefslogtreecommitdiff
path: root/apps/JAWS/PROTOTYPE/JAWS/Reaper.cpp
blob: a6afbf85695ddbdb0fcbaa127025ec129b58a8e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// $Id$

#include "JAWS/Reaper.h"
#include "JAWS/Concurrency.h"

ACE_RCSID(JAWS, Reaper, "$Id$")

JAWS_Reaper::JAWS_Reaper (JAWS_Concurrency_Base *concurrency)
  : concurrency_ (concurrency),
    waiting_ (0)
{
}

JAWS_Reaper::~JAWS_Reaper (void)
{
}

int
JAWS_Reaper::open (void *)
{
  if (this->waiting_ == 0)
    {
      ACE_Guard<ACE_SYNCH_MUTEX> g (this->lock_);
      if (this->waiting_ == 0)
        {
          if (this->activate () == -1)
            ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "JAWS_Reaper::activate"),
                              -1);
          this->waiting_ = 1;
        }
    }
  return 0;
}

int
JAWS_Reaper::svc (void)
{
  return this->concurrency_->wait ();
}