Locking.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file    Locking.h
00006  *
00007  *  Locking.h,v 1.10 2005/11/16 07:53:25 ossama Exp
00008  *
00009  *  @author Marina Spivak <marina@cs.wustl.edu>
00010  *  @author Seth Widoff <sbw1@cs.wustl.edu>
00011  *  @author Irfan Pyarali <irfan@cs.wustl.edu>
00012  */
00013 //=============================================================================
00014 
00015 #ifndef TAO_LOCKING_H
00016 #define TAO_LOCKING_H
00017 
00018 #include /**/ "ace/pre.h"
00019 
00020 // Macros for obtaining read/write locks that are
00021 // automatically released at the end of scope.
00022 // In case of failure, CORBA::SystemException is thrown.
00023 
00024 #define TAO_WRITE_GUARD(MUTEX,OBJ,LOCK) \
00025 ACE_Write_Guard<MUTEX> OBJ (LOCK); \
00026 if (OBJ.locked () == 0) \
00027   TAO_THROW (CORBA::UNKNOWN (TAO_DEFAULT_MINOR_CODE, CORBA::COMPLETED_NO));
00028 
00029 #define TAO_READ_GUARD(MUTEX,OBJ,LOCK) \
00030 ACE_Read_Guard<MUTEX> OBJ (LOCK); \
00031 if (OBJ.locked () == 0) \
00032   TAO_THROW (CORBA::UNKNOWN (TAO_DEFAULT_MINOR_CODE, CORBA::COMPLETED_NO));
00033 
00034 #define TAO_WRITE_GUARD_RETURN(MUTEX,OBJ,LOCK,RETURN) \
00035 ACE_Write_Guard<MUTEX> OBJ (LOCK); \
00036 if (OBJ.locked () == 0) \
00037   TAO_THROW_RETURN (CORBA::UNKNOWN (TAO_DEFAULT_MINOR_CODE, CORBA::COMPLETED_NO), RETURN);
00038 
00039 #define TAO_READ_GUARD_RETURN(MUTEX,OBJ,LOCK,RETURN) \
00040 ACE_Read_Guard<MUTEX> OBJ (LOCK); \
00041 if (OBJ.locked () == 0) \
00042   TAO_THROW_RETURN (CORBA::UNKNOWN (TAO_DEFAULT_MINOR_CODE, CORBA::COMPLETED_NO), RETURN);
00043 
00044 #include /**/ "ace/post.h"
00045 
00046 #endif /* TAO_LOCKING_H */

Generated on Thu Nov 9 13:59:57 2006 for TAO_CosTrader by doxygen 1.3.6