/usr/include/sipxtapi/os/OsBSem.h is in libsipxtapi-dev 3.3.0~test17-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | //
// Copyright (C) 2006 SIPez LLC.
// Licensed to SIPfoundry under a Contributor Agreement.
//
// Copyright (C) 2004-2006 SIPfoundry Inc.
// Licensed by SIPfoundry under the LGPL license.
//
// Copyright (C) 2004-2006 Pingtel Corp. All rights reserved.
// Licensed to SIPfoundry under a Contributor Agreement.
//
// $$
///////////////////////////////////////////////////////////////////////////////
#ifndef _OsBSem_h_
#define _OsBSem_h_
// SYSTEM INCLUDES
// APPLICATION INCLUDES
#include "os/OsDefs.h"
#include "os/OsSyncBase.h"
// DEFINES
// MACROS
// EXTERNAL FUNCTIONS
// EXTERNAL VARIABLES
// CONSTANTS
// STRUCTS
// TYPEDEFS
// FORWARD DECLARATIONS
/// Binary semaphore
class OsBSemBase : public OsSyncBase
{
/* //////////////////////////// PUBLIC //////////////////////////////////// */
public:
enum InitialSemaphoreState
{
EMPTY = 0, ///< semaphore is initially unavailable
FULL = 1 ///< semaphore is initially available
};
enum QueueOptions
{
Q_FIFO = 0x0, ///< queue blocked tasks on a first-in, first-out basis
Q_PRIORITY = 0x1 ///< queue blocked tasks based on their priority
};
/* ============================ CREATORS ================================== */
/* ============================ MANIPULATORS ============================== */
/// Block the task until the semaphore is acquired or the timeout expires
virtual OsStatus acquire(const OsTime& rTimeout = OsTime::OS_INFINITY) = 0;
/// Conditionally acquire the semaphore (i.e., don't block)
virtual OsStatus tryAcquire(void) = 0;
/**
* @return OS_BUSY if the semaphore is held by some other task.
*/
/// Release the semaphore
virtual OsStatus release(void) = 0;
/* ============================ ACCESSORS ================================= */
/// Print semaphore information to the console
virtual void OsBSemShow(void) = 0;
/* ============================ INQUIRY =================================== */
/* //////////////////////////// PROTECTED ///////////////////////////////// */
protected:
int mOptions; ///< options specified at time of binary semaphore creation
int mTaskId; ///< if OS_SYNC_DEBUG is enabled, ONLY ON WNT, we use this
///< variable to store the ID of the task currently holding the semaphore
/// Default constructor
OsBSemBase() { };
/// Destructor
virtual
~OsBSemBase() { };
/* //////////////////////////// PRIVATE /////////////////////////////////// */
private:
/// Copy constructor (not implemented for this class)
OsBSemBase(const OsBSemBase& rOsBSemBase);
/// Assignment operator (not implemented for this class)
OsBSemBase& operator=(const OsBSemBase& rhs);
};
/* ============================ INLINE METHODS ============================ */
/// Depending on the native OS that we are running on, we include the class
/// declaration for the appropriate lower level implementation and use a
/// "typedef" statement to associate the OS-independent class name (OsBSem)
/// with the OS-dependent realization of that type (e.g., OsBSemWnt).
#if defined(_WIN32)
# include "os/Wnt/OsBSemWnt.h"
typedef class OsBSemWnt OsBSem;
#elif defined(_VXWORKS)
# include "os/Vxw/OsBSemVxw.h"
typedef class OsBSemVxw OsBSem;
#elif defined(__pingtel_on_posix__)
# include "os/linux/OsBSemLinux.h"
typedef class OsBSemLinux OsBSem;
#else
# error Unsupported target platform.
#endif
#endif // _OsBSem_h_
|