File: Reaper.cpp

package info (click to toggle)
ace 6.0.3%2Bdfsg-0.1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 49,368 kB
  • sloc: cpp: 341,826; perl: 30,850; ansic: 20,952; makefile: 10,144; sh: 4,744; python: 828; exp: 787; yacc: 511; xml: 330; lex: 158; lisp: 116; csh: 48; tcl: 5
file content (45 lines) | stat: -rw-r--r-- 987 bytes parent folder | download | duplicates (2)
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
40
41
42
43
44
45
// $Id: Reaper.cpp 91671 2010-09-08 18:39:23Z johnnyw $

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



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_RETURN (ACE_SYNCH_MUTEX, g ,this->lock_, -1);
      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)
{
  ACE_TRACE ("JAWS_Reaper::svc");
  int result = this->concurrency_->thr_mgr ()->wait ();
  JAWS_IO_Synch_Acceptor_Singleton::instance ()->close ();
  JAWS_IO_Asynch_Acceptor_Singleton::instance ()->close ();
  ACE_DEBUG ((LM_DEBUG, "(%t) Leaving REAPER\n"));
  return result;
}