sipxportlib  Version 3.3
OsBSemWnt.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 
12 #ifndef _OsBSemWnt_h_
13 #define _OsBSemWnt_h_
14 
15 // SYSTEM INCLUDES
16 #define WIN32_LEAN_AND_MEAN
17 #include <windows.h>
18 
19 // APPLICATION INCLUDES
20 #include "os/OsBSem.h"
21 
22 // DEFINES
23 // MACROS
24 // EXTERNAL FUNCTIONS
25 // EXTERNAL VARIABLES
26 // CONSTANTS
27 // STRUCTS
28 
29 // TYPEDEFS
30 typedef HANDLE WinSemaphore;
31 
32 // FORWARD DECLARATIONS
33 
34 //:Binary semaphore for Windows NT
35 class OsBSemWnt : public OsBSemBase
36 {
37 /* //////////////////////////// PUBLIC //////////////////////////////////// */
38 public:
39 
40 /* ============================ CREATORS ================================== */
41 
42  OsBSemWnt(const int queueOptions, const int initState);
43  //:Constructor
44 
45  virtual
46  ~OsBSemWnt();
47  //:Destructor
48 
49 /* ============================ MANIPULATORS ============================== */
50 
51  virtual OsStatus acquire(const OsTime& rTimeout = OsTime::OS_INFINITY);
52  //:Block the task until the semaphore is acquired or the timeout expires
53 
54  virtual OsStatus tryAcquire(void);
55  //:Conditionally acquire the semaphore (i.e., don't block)
56  // Return OS_BUSY if the semaphore is held by some other task
57 
58  virtual OsStatus release(void);
59  //:Release the semaphore
60 
61 /* ============================ ACCESSORS ================================= */
62 
63  virtual void OsBSemShow(void);
64  //:Print semaphore information to the console
65 
66 /* ============================ INQUIRY =================================== */
67 
68 /* //////////////////////////// PROTECTED ///////////////////////////////// */
69 protected:
70 
71 /* //////////////////////////// PRIVATE /////////////////////////////////// */
72 private:
73  WinSemaphore mSemImp; // Windows NT semaphore
74 
75  OsBSemWnt();
76  //:Default constructor (not implemented for this class)
77 
78  OsBSemWnt(const OsBSemWnt& rOsBSemWnt);
79  //:Copy constructor (not implemented for this class)
80 
81  OsBSemWnt& operator=(const OsBSemWnt& rhs);
82  //:Assignment operator (not implemented for this class)
83 
84 };
85 
86 /* ============================ INLINE METHODS ============================ */
87 
88 #endif // _OsBSemWnt_h_
89 
virtual ~OsBSemWnt()
Definition: OsBSemWnt.cpp:58
virtual OsStatus tryAcquire(void)
Conditionally acquire the semaphore (i.e., don&#39;t block)
Definition: OsBSemWnt.cpp:90
virtual OsStatus acquire(const OsTime &rTimeout=OsTime::OS_INFINITY)
Block the task until the semaphore is acquired or the timeout expires.
Definition: OsBSemWnt.cpp:74
virtual OsStatus release(void)
Release the semaphore.
Definition: OsBSemWnt.cpp:105
OsStatus
Definition: OsStatus.h:27
Definition: OsTime.h:45
Definition: OsBSemWnt.h:35
Definition: OsTime.h:37
virtual void OsBSemShow(void)
Print semaphore information to the console.
Definition: OsBSemWnt.cpp:148
HANDLE WinSemaphore
Definition: OsBSemWnt.h:30
Binary semaphore.
Definition: OsBSem.h:33