/usr/include/sipxtapi/os/OsMutex.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 118 119 120 121 122 123 124 125 126 127 128 | //
// 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 _OsMutex_h_
#define _OsMutex_h_
// SYSTEM INCLUDES
// APPLICATION INCLUDES
#include "os/OsDefs.h"
#include "os/OsSyncBase.h"
// DEFINES
// MACROS
// EXTERNAL FUNCTIONS
// EXTERNAL VARIABLES
// CONSTANTS
// STRUCTS
// TYPEDEFS
// FORWARD DECLARATIONS
/**
* @brief Mutual exclusion semaphore (mutex)
*
* The mutual-exclusion semaphore is a specialized version of the binary
* semaphore, designed to address issues inherent in mutual exclusion, such
* as recursive access to resources, priority inversion, and deletion safety.
*
* The fundamental behavior of the mutual-exclusion semaphore is identical to
* that of a binary semaphore except for^
*
* * It can only be used for mutual exclusion and it can only be released by the
* task that acquired it.
*
* * If a thread already holds the mutex, it may acquire it again without
* first releasing it. The thread must release the mutex as many times as it
* has acquired it before the mutex is free to be acquired by another thread.
*/
class OsMutexBase : public OsSyncBase
{
/* //////////////////////////// PUBLIC //////////////////////////////////// */
public:
enum MutexOptions
{
Q_FIFO = 0x0, ///< queue blocked tasks on a first-in, first-out
///< basis
Q_PRIORITY = 0x1, ///< queue blocked tasks based on their priority
DELETE_SAFE = 0x4, ///< protect a task that owns the mutex from
///< unexpected deletion
INVERSION_SAFE = 0x8 ///< protect the system from priority inversion: NOTE
///< VxWorks requires Q_PRIORITY with this.
};
/* ============================ CREATORS ================================== */
/* ============================ MANIPULATORS ============================== */
/// Block the task until the mutex is acquired or the timeout expires
virtual OsStatus acquire(const OsTime& rTimeout = OsTime::OS_INFINITY) = 0;
/// Conditionally acquire the mutex (i.e., don't block)
virtual OsStatus tryAcquire(void) = 0;
/**
* @return OS_BUSY if the mutex is held by some other task
*/
/// Release the mutex
virtual OsStatus release(void) = 0;
/* ============================ ACCESSORS ================================= */
/// Print mutex information to the console.
virtual void OsMutexShow(void) = 0;
/* ============================ INQUIRY =================================== */
/* //////////////////////////// PROTECTED ///////////////////////////////// */
protected:
/// Default constructor
OsMutexBase() { };
/// Destructor
virtual
~OsMutexBase() { };
/* //////////////////////////// PRIVATE /////////////////////////////////// */
private:
/// Copy constructor (not implemented for this class)
OsMutexBase(const OsMutexBase& rOsMutexBase);
/// Assignment operator (not implemented for this class)
OsMutexBase& operator=(const OsMutexBase& 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 (OsMutex)
/// with the OS-dependent realization of that type (e.g., OsMutexWnt).
#if defined(_WIN32)
# include "os/Wnt/OsMutexWnt.h"
typedef class OsMutexWnt OsMutex;
#elif defined(_VXWORKS)
# include "os/Vxw/OsMutexVxw.h"
typedef class OsMutexVxw OsMutex;
#elif defined(__pingtel_on_posix__)
# include "os/linux/OsMutexLinux.h"
typedef class OsMutexLinux OsMutex;
#else
# error Unsupported target platform.
#endif
#endif // _OsMutex_h_
|