sipxportlib  Version 3.3
OsBSemLinux.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2004-2006 SIPfoundry Inc.
3 // Licensed by SIPfoundry under the LGPL license.
4 //
5 // Copyright (C) 2004-2006 Pingtel Corp. All rights reserved.
6 // Licensed to SIPfoundry under a Contributor Agreement.
7 //
8 // $$
10 
11 #ifndef _OsBSemLinux_h_
12 #define _OsBSemLinux_h_
13 
14 // SYSTEM INCLUDES
15 
16 // APPLICATION INCLUDES
17 #include "os/OsBSem.h"
18 #include "os/linux/OsLinuxDefs.h"
19 #include "os/linux/pt_csem.h"
20 
21 // DEFINES
22 // MACROS
23 // EXTERNAL FUNCTIONS
24 // EXTERNAL VARIABLES
25 // CONSTANTS
26 // STRUCTS
27 // TYPEDEFS
28 // FORWARD DECLARATIONS
29 
30 //:Binary semaphore for Linux
31 class OsBSemLinux : public OsBSemBase
32 {
33 /* //////////////////////////// PUBLIC //////////////////////////////////// */
34 public:
35 
36 /* ============================ CREATORS ================================== */
37 
38  OsBSemLinux(const int queueOptions, const int initState);
39  //:Constructor
40 
41  virtual
42  ~OsBSemLinux();
43  //:Destructor
44 
45 /* ============================ MANIPULATORS ============================== */
46 
47  virtual OsStatus acquire(const OsTime& rTimeout = OsTime::OS_INFINITY);
48  //:Block the task until the semaphore is acquired or the timeout expires
49 
50  virtual OsStatus tryAcquire(void);
51  //:Conditionally acquire the semaphore (i.e., don't block)
52  // Return OS_BUSY if the semaphore is held by some other task
53 
54  virtual OsStatus release(void);
55  //:Release the semaphore
56 
57 /* ============================ ACCESSORS ================================= */
58 
59  virtual void OsBSemShow(void);
60  //:Print semaphore information to the console
61 
62 /* ============================ INQUIRY =================================== */
63 
64 /* //////////////////////////// PROTECTED ///////////////////////////////// */
65 protected:
66 
67 /* //////////////////////////// PRIVATE /////////////////////////////////// */
68 private:
69  pt_sem_t mSemImp; // Pingtel-Linux counting semaphore
70 
71  OsBSemLinux();
72  //:Default constructor (not implemented for this class)
73 
74  OsBSemLinux(const OsBSemLinux& rOsBSemLinux);
75  //:Copy constructor (not implemented for this class)
76 
77  OsBSemLinux& operator=(const OsBSemLinux& rhs);
78  //:Assignment operator (not implemented for this class)
79 
80 };
81 
82 /* ============================ INLINE METHODS ============================ */
83 
84 #endif // _OsBSemLinux_h_
85 
#define pt_sem_t
Definition: pt_csem.h:35
OsStatus
Definition: OsStatus.h:27
virtual OsStatus acquire(const OsTime &rTimeout=OsTime::OS_INFINITY)
Block the task until the semaphore is acquired or the timeout expires.
Definition: OsBSemLinux.cpp:78
virtual void OsBSemShow(void)
Print semaphore information to the console.
Definition: OsBSemLinux.cpp:149
virtual OsStatus release(void)
Release the semaphore.
Definition: OsBSemLinux.cpp:132
Definition: OsTime.h:45
Definition: OsBSemLinux.h:31
virtual ~OsBSemLinux()
Definition: OsBSemLinux.cpp:55
Definition: OsTime.h:37
Binary semaphore.
Definition: OsBSem.h:33
virtual OsStatus tryAcquire(void)
Conditionally acquire the semaphore (i.e., don't block)
Definition: OsBSemLinux.cpp:117