os_semaphore.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file    os_semaphore.h
00006  *
00007  *  semaphores (REALTIME)
00008  *
00009  *  os_semaphore.h,v 1.5 2006/03/06 18:28:51 elliott_c Exp
00010  *
00011  *  @author Don Hinton <dhinton@dresystems.com>
00012  *  @author This code was originally in various places including ace/OS.h.
00013  */
00014 //=============================================================================
00015 
00016 #ifndef ACE_OS_INCLUDE_OS_SEMAPHORE_H
00017 #define ACE_OS_INCLUDE_OS_SEMAPHORE_H
00018 
00019 #include /**/ "ace/pre.h"
00020 
00021 #include "ace/config-all.h"
00022 
00023 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00024 # pragma once
00025 #endif /* ACE_LACKS_PRAGMA_ONCE */
00026 
00027 #include "ace/os_include/os_time.h"
00028 
00029 #if !defined (ACE_LACKS_SEMAPHORE_H)
00030 # include /**/ <semaphore.h>
00031 #endif /* !ACE_LACKS_SEMAPHORE_H */
00032 
00033 // Place all additions (especially function declarations) within extern "C" {}
00034 #ifdef __cplusplus
00035 extern "C"
00036 {
00037 #endif /* __cplusplus */
00038 
00039 #if defined (ACE_HAS_POSIX_SEM)
00040 #  if !defined (SEM_FAILED) && !defined (ACE_LACKS_NAMED_POSIX_SEM)
00041 #    define SEM_FAILED ((sem_t *) -1)
00042 #  endif  /* !SEM_FAILED */
00043 
00044    typedef struct
00045    {
00046      /// Pointer to semaphore handle.  This is allocated by ACE if we are
00047      /// working with an unnamed POSIX semaphore or by the OS if we are
00048      /// working with a named POSIX semaphore.
00049      sem_t *sema_;
00050 
00051      /// Name of the semaphore (if this is non-NULL then this is a named
00052      /// POSIX semaphore, else its an unnamed POSIX semaphore).
00053      char *name_;
00054 
00055 #  if defined (ACE_LACKS_NAMED_POSIX_SEM)
00056      /// this->sema_ doesn't always get created dynamically if a platform
00057      /// doesn't support named posix semaphores.  We use this flag to
00058      /// remember if we need to delete <sema_> or not.
00059      int new_sema_;
00060 #  endif /* ACE_LACKS_NAMED_POSIX_SEM */
00061 
00062 #  if !defined (ACE_HAS_POSIX_SEM_TIMEOUT)
00063      /// Serialize access to internal state.
00064      ACE_mutex_t lock_;                     
00065 
00066      /// Block until there are no waiters.
00067      ACE_cond_t count_nonzero_;
00068 #  endif /* !ACE_HAS_POSIX_SEM_TIMEOUT */
00069    } ACE_sema_t;
00070 #endif /* ACE_HAS_POSIX_SEM */
00071 
00072 #ifdef __cplusplus
00073 }
00074 #endif /* __cplusplus */
00075 
00076 #include /**/ "ace/post.h"
00077 #endif /* ACE_OS_INCLUDE_OS_SEMAPHORE_H */

Generated on Thu Nov 9 09:41:58 2006 for ACE by doxygen 1.3.6