summaryrefslogtreecommitdiff
path: root/TAO/tao/poa_macros.h
blob: b46ae1a10f8f0f6e4d7994de6bf6fc28a231b316 (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
// Convenient macro for testing for deadlock, as well as for detecting
// when mutexes fail.
#define TAO_POA_WRITE_GUARD(MUTEX,OBJ,LOCK,ENV) \
  do { \
    ACE_Write_Guard<MUTEX> OBJ (LOCK); \
    if (OBJ.locked () == 0) \
      { \
        CORBA::Exception *exception = new CORBA::OBJ_ADAPTER (CORBA::COMPLETED_NO); \
        ENV.exception (exception); \
        return; \
      } \
  } \
  while (0);
#define TAO_POA_READ_GUARD(MUTEX,OBJ,LOCK,ENV) \
  do { \
    ACE_Read_Guard<MUTEX> OBJ (LOCK); \
    if (OBJ.locked () == 0) \
      { \
        CORBA::Exception *exception = new CORBA::OBJ_ADAPTER (CORBA::COMPLETED_NO); \
        ENV.exception (exception); \
        return; \
      } \
  } \
  while (0);
#define TAO_POA_WRITE_GUARD_RETURN(MUTEX,OBJ,LOCK,RETURN,ENV) \
  do { \
    ACE_Write_Guard<MUTEX> OBJ (LOCK); \
    if (OBJ.locked () == 0) \
      { \
        CORBA::Exception *exception = new CORBA::OBJ_ADAPTER (CORBA::COMPLETED_NO); \
        ENV.exception (exception); \
        return RETURN; \
      } \
  } \
  while (0);
#define TAO_POA_READ_GUARD_RETURN(MUTEX,OBJ,LOCK,RETURN,ENV) \
  do { \
    ACE_Read_Guard<MUTEX> OBJ (LOCK); \
    if (OBJ.locked () == 0) \
      { \
        CORBA::Exception *exception = new CORBA::OBJ_ADAPTER (CORBA::COMPLETED_NO); \
        ENV.exception (exception); \
        return RETURN; \
      } \
  } \
  while (0);