sipxportlib  Version 3.3
OsUtilWnt.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 _OsUtilWnt_h_
13 #define _OsUtilWnt_h_
14 
15 // SYSTEM INCLUDES
16 #define WIN32_LEAN_AND_MEAN
17 #include <windows.h>
18 
19 // APPLICATION INCLUDES
20 #include "utl/UtlDefs.h"
21 #include "os/OsDefs.h"
22 #include "os/OsStatus.h"
23 #include "os/OsTime.h"
24 
25 // DEFINES
26 // MACROS
27 // EXTERNAL FUNCTIONS
28 // EXTERNAL VARIABLES
29 // CONSTANTS
30 // STRUCTS
31 // TYPEDEFS
32 // FORWARD DECLARATIONS
33 
34 //:Static methods that are useful when running on top of Window NT
35 class OsUtilWnt
36 {
37 /* //////////////////////////// PUBLIC //////////////////////////////////// */
38 public:
39 
40 /* ============================ CREATORS ================================== */
41 
42 /* ============================ MANIPULATORS ============================== */
43 
44  static OsStatus synchObjAcquire(const HANDLE synchObj,
45  const OsTime& rTimeout = OsTime::OS_INFINITY);
46  //:Block the task until the synch obj is acquired or the timeout expires
47 
48  static OsStatus synchObjTryAcquire(const HANDLE synchObj);
49  //:Conditionally acquire the synch obj (i.e., don't block)
50  // Return OS_BUSY if the synch object is held by some other task
51 
52 /* ============================ ACCESSORS ================================= */
53 
54  static DWORD cvtOsTimeToWntTime(const OsTime& rTimer);
55  //:Convert an OsTime to the corresponding number of millisecs for WinNT
56 
57  static int cvtOsPrioToWntPrio(const int osPrio);
58  //:Convert an abstraction layer task priority to a WinNT thread priority
59 
60  static int cvtWntPrioToOsPrio(const int wntPrio);
61  //:Convert a WinNT thread priority to an abstraction layer task priority
62 /* ============================ INQUIRY =================================== */
63 
64  static UtlBoolean isOsTimeValid(const OsTime& rTimer);
65  //:Verify that the OsTime is >= 0 and representable in msecs
66 
67 /* //////////////////////////// PROTECTED ///////////////////////////////// */
68 protected:
69 
70 /* //////////////////////////// PRIVATE /////////////////////////////////// */
71 private:
72 
73  OsUtilWnt();
74  //:Default constructor (not implemented for this class)
75 
76  OsUtilWnt(const OsUtilWnt& rOsUtilWnt);
77  //:Copy constructor (not implemented for this class)
78 
79  virtual
80  ~OsUtilWnt();
81  //:Destructor (not implemented for this class)
82 
83  OsUtilWnt& operator=(const OsUtilWnt& rhs);
84  //:Assignment operator (not implemented for this class)
85 
86 
87 };
88 
89 /* ============================ INLINE METHODS ============================ */
90 
91 #endif // _OsUtilWnt_h_
static OsStatus synchObjTryAcquire(const HANDLE synchObj)
Definition: OsUtilWnt.cpp:91
static UtlBoolean isOsTimeValid(const OsTime &rTimer)
Definition: OsUtilWnt.cpp:172
OsStatus
Definition: OsStatus.h:27
static DWORD cvtOsTimeToWntTime(const OsTime &rTimer)
Definition: OsUtilWnt.cpp:107
Definition: OsTime.h:45
static int cvtWntPrioToOsPrio(const int wntPrio)
Definition: OsUtilWnt.cpp:139
Definition: OsTime.h:37
int UtlBoolean
Definition: UtlDefs.h:41
static int cvtOsPrioToWntPrio(const int osPrio)
Definition: OsUtilWnt.cpp:114
Definition: OsUtilWnt.h:35
static OsStatus synchObjAcquire(const HANDLE synchObj, const OsTime &rTimeout=OsTime::OS_INFINITY)
Definition: OsUtilWnt.cpp:48