Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

SV_Semaphore_Simple.i

Go to the documentation of this file.
00001 /* -*- C++ -*- */
00002 // $Id: SV_Semaphore_Simple.i,v 1.1.1.2 2001/12/04 14:33:08 chad Exp $
00003 
00004 // SV_Semaphore_Simple.i
00005 
00006 #include "ace/Trace.h"
00007 
00008 ASYS_INLINE int
00009 ACE_SV_Semaphore_Simple::control (int cmd, 
00010                                   semun arg, 
00011                                   u_short n) const
00012 {
00013   ACE_TRACE ("ACE_SV_Semaphore_Simple::control");
00014   return this->internal_id_ == -1 ? 
00015     -1 : ACE_OS::semctl (this->internal_id_, n, cmd, arg);
00016 }
00017 
00018 // Close a ACE_SV_Semaphore, marking it as invalid for subsequent
00019 // operations...
00020 
00021 ASYS_INLINE int 
00022 ACE_SV_Semaphore_Simple::close (void)
00023 {
00024   ACE_TRACE ("ACE_SV_Semaphore_Simple::close");
00025   return this->init ();
00026 }
00027 
00028 // General ACE_SV_Semaphore operation on an array of SV_Semaphores. 
00029      
00030 ASYS_INLINE int 
00031 ACE_SV_Semaphore_Simple::op (sembuf op_vec[], u_short n) const
00032 {
00033   ACE_TRACE ("ACE_SV_Semaphore_Simple::op");
00034   return this->internal_id_ == -1 
00035     ? -1 : ACE_OS::semop (this->internal_id_, op_vec, n);
00036 }
00037 
00038 // Wait until a ACE_SV_Semaphore's value is greater than 0, the
00039 // decrement it by 1 and return. Dijkstra's P operation, Tannenbaums
00040 // DOWN operation.
00041 
00042 ASYS_INLINE int 
00043 ACE_SV_Semaphore_Simple::acquire (u_short n, int flags) const
00044 {
00045   ACE_TRACE ("ACE_SV_Semaphore_Simple::acquire");
00046   return this->op (-1, n, flags);
00047 }
00048 
00049 ASYS_INLINE int 
00050 ACE_SV_Semaphore_Simple::acquire_read (u_short n, int flags) const
00051 {
00052   ACE_TRACE ("ACE_SV_Semaphore_Simple::acquire_read");
00053   return this->acquire (n, flags);
00054 }
00055 
00056 ASYS_INLINE int 
00057 ACE_SV_Semaphore_Simple::acquire_write (u_short n, int flags) const
00058 {
00059   ACE_TRACE ("ACE_SV_Semaphore_Simple::acquire_write");
00060   return this->acquire (n, flags);
00061 }
00062 
00063 // Non-blocking version of acquire(). 
00064 
00065 ASYS_INLINE int 
00066 ACE_SV_Semaphore_Simple::tryacquire (u_short n, int flags) const
00067 {
00068   ACE_TRACE ("ACE_SV_Semaphore_Simple::tryacquire");
00069   return this->op (-1, n, flags | IPC_NOWAIT);
00070 }
00071 
00072 // Non-blocking version of acquire(). 
00073 
00074 ASYS_INLINE int 
00075 ACE_SV_Semaphore_Simple::tryacquire_read (u_short n, int flags) const
00076 {
00077   ACE_TRACE ("ACE_SV_Semaphore_Simple::tryacquire_read");
00078   return this->tryacquire (n, flags);
00079 }
00080 
00081 // Non-blocking version of acquire(). 
00082 
00083 ASYS_INLINE int 
00084 ACE_SV_Semaphore_Simple::tryacquire_write (u_short n, int flags) const
00085 {
00086   ACE_TRACE ("ACE_SV_Semaphore_Simple::tryacquire_write");
00087   return this->tryacquire (n, flags);
00088 }
00089 
00090 // Increment ACE_SV_Semaphore by one. Dijkstra's V operation,
00091 // Tannenbaums UP operation.
00092 
00093 ASYS_INLINE int 
00094 ACE_SV_Semaphore_Simple::release (u_short n, int flags) const
00095 {
00096   ACE_TRACE ("ACE_SV_Semaphore_Simple::release");
00097   return this->op (1, n, flags);
00098 }
00099 
00100 ASYS_INLINE int
00101 ACE_SV_Semaphore_Simple::get_id (void) const
00102 {
00103   ACE_TRACE ("ACE_SV_Semaphore_Simple::get_id");
00104   return this->internal_id_;
00105 }
00106 

Generated on Mon Jun 16 11:21:33 2003 for ACE by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002