summaryrefslogtreecommitdiff
path: root/ACE/apps/JAWS3/jaws3/Concurrency_T.cpp
blob: 09e8cd3f6cd817a7d880b586bcc161737449da16 (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
40
41
42
43
44
45
46
47
// $Id$

#include "ace/Message_Block.h"
#include "ace/Singleton.h"
#include "ace/Synch_Traits.h"
#include "ace/Null_Mutex.h"

#include "jaws3/Concurrency_T.h"

typedef ACE_Singleton<ACE_Message_Block, ACE_SYNCH_NULL_MUTEX>
        JAWS_Empty_Message_Block;


template <class CONCURRENCY_IMPL>
JAWS_Concurrency_Bridge<CONCURRENCY_IMPL>
::JAWS_Concurrency_Bridge (CONCURRENCY_IMPL *impl)
  : impl_ (impl)
{
  if (this->impl_ == 0)
    this->impl_ = CONCURRENCY_IMPL::instance ();
}


template <class CONCURRENCY_IMPL> int
JAWS_Concurrency_Bridge<CONCURRENCY_IMPL>::putq (JAWS_Protocol_Handler *ph)
{
  return this->impl_->putq (ph);
}


template <class CONCURRENCY_IMPL> int
JAWS_Concurrency_Bridge<CONCURRENCY_IMPL>::getq (JAWS_Protocol_Handler *&ph)
{
  return this->impl_->getq (ph);
}


template <class CONCURRENCY_IMPL> void
JAWS_Concurrency_Bridge<CONCURRENCY_IMPL>::shutdown (void)
{
  ACE_Message_Block *empty_mb = JAWS_Empty_Message_Block::instance ();
  JAWS_CONCURRENCY_TASK *task;

  task = this->impl_;
  task->putq (empty_mb);
  task->wait ();
}