summaryrefslogtreecommitdiff
path: root/apps/JAWS3/jaws3/Concurrency.h
blob: 2f8b8a18873b792255d37e66dede32879147c6a5 (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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
// -*- C++ -*-
//
// $Id$

#ifndef JAWS_CONCURRENCY_H
#define JAWS_CONCURRENCY_H

#include "ace/Task.h"
#include "ace/Singleton.h"
#include "ace/Synch_Traits.h"

#include "jaws3/Export.h"
#include "jaws3/Protocol_Handler.h"


typedef ACE_Task<ACE_SYNCH> JAWS_CONCURRENCY_TASK;

class JAWS_Export JAWS_Concurrency_Impl : public JAWS_CONCURRENCY_TASK
{
public:

  virtual ~JAWS_Concurrency_Impl (void) {};

  virtual int putq (JAWS_Protocol_Handler *ph) = 0;

  virtual int getq (JAWS_Protocol_Handler *&ph) = 0;

  int svc (void);

};


// Include the templates here.
#include "jaws3/Concurrency_T.h"


template<>
class JAWS_Export JAWS_Concurrency_Bridge<JAWS_Concurrency_Impl>
{
public:

  JAWS_Concurrency_Bridge (JAWS_Concurrency_Impl *impl = 0);

  int putq (JAWS_Protocol_Handler *ph);
  int getq (JAWS_Protocol_Handler *&ph);

  void shutdown (void);

protected:

  JAWS_Concurrency_Impl *impl_;

};


#ifndef JAWS_CONCURRENCY_CONCRETE_IMPL
#define JAWS_CONCURRENCY_CONCRETE_IMPL JAWS_Concurrency_Impl
#endif /* JAWS_CONCURRENCY_CONCRETE_IMPL */


class JAWS_Export JAWS_Concurrency
  : public JAWS_Concurrency_Bridge<JAWS_CONCURRENCY_CONCRETE_IMPL>
{
public:

  static JAWS_Concurrency * instance (void)
  {
    return ACE_Singleton<JAWS_Concurrency, ACE_SYNCH_MUTEX>::instance ();
  }

};


#endif /* JAWS_CONCURRENCY_H */