/usr/include/ClearSilver/util/ulocks.h is in clearsilver-dev 0.10.5-1.6build1.
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 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 | /*
*
* Thread-safe Skiplist Using Integer Identifiers
* Copyright 1998-2000 Scott Shambarger (scott@shambarger.net)
*
* This software is open source. Permission to use, copy, modify, and
* distribute this software for any purpose and without fee is hereby granted,
* provided that the above copyright notice appear in all copies. No
* warranty of any kind is expressed or implied. Use at your own risk.
*
* 1/14/2001 blong
* Made it use neo errs... probably need to check locking functions
* for error returns...
*
*/
#ifndef __ULOCKS_H_
#define __ULOCKS_H_
NEOERR *fCreate(int *plock, const char *file);
/*
* Function: fCreate - create a file lock.
* Description: Creates a file lock on named file <file>. The lock is
* returned in <plock>.
* Input: plock - place for lock.
* file - path of file to use as lock.
* Output: plock - set to lock identifier.
* Return: STATUS_OK on success
* NERR_IO on failure
* MT-Level: Safe.
*/
NEOERR *fFind(int *plock, const char *file);
/*
* Function: fFind - find a file lock.
* Description: Find a file identified by the path <file>, and returns a
* lock identifier for it in <plock>. If the file doesn't
* exist, returns true.
* Input: plock - place for lock.
* file - path of file to use as lock.
* Output: plock - set to lock identifier.
* Return: STATUS_OK if found
* NERR_IO on failure
* MT-Level: Safe.
*/
void fDestroy(int lock);
/*
* Function: fDestroy - destroy a lock.
* Description: Destroys the lock <lock> that was created by fCreate()
* or fFind().
* Input: lock - Lock to destroy.
* Output: None.
* Return: None.
* MT-Level: Safe for unique <lock>.
*/
NEOERR *fLock(int lock);
/*
* Function: fLock - acquire file lock.
* Description: Acquires the lock identified by <lock>. This call
* blocks until the lock is acquired.
* Input: lock - Lock to acquire.
* Output: None.
* Return: STATUS_OK on success
* NERR_LOCK on failure
* MT-Level: Safe.
*/
void fUnlock(int lock);
/*
* Function: fUnlock - release file lock.
* Description: Releases the lock identified by <lock>.
* Input: lock - Lock to release.
* Output: None.
* Return: None.
* MT-Level: Safe.
*/
#ifdef HAVE_PTHREADS
#include <pthread.h>
NEOERR *mCreate(pthread_mutex_t *mutex);
/*
* Function: mCreate - initialize a mutex.
* Description: Initializes the mutex <mutex>.
* Input: mutex - mutex to initialize.
* Output: None.
* Return: STATUS_OK on success
* NERR_LOCK on failure
* MT-Level: Safe for unique <mutex>.
*/
void mDestroy(pthread_mutex_t *mutex);
/*
* Function: mDestroy - destroy a mutex.
* Description: Destroys the mutex <mutex> that was initialized by mCreate().
* Input: mutex - mutex to destroy.
* Output: None.
* Return: None.
* MT-Level: Safe for unique <mutex>.
*/
NEOERR *mLock(pthread_mutex_t *mutex);
/*
* Function: mLock - lock a mutex.
* Description: Locks the mutex <mutex>. This call blocks until the mutex
* is acquired.
* Input: mutex - mutex to lock.
* Output: None.
* Return: STATUS_OK on success
* NERR_LOCK on failure
* MT-Level: Safe.
*/
NEOERR *mUnlock(pthread_mutex_t *mutex);
/*
* Function: mUnlock - unlock a mutex.
* Description: Unlocks the mutex <mutex>.
* Input: mutex - mutex to unlock.
* Output: None.
* Return: STATUS_OK on success
* NERR_LOCK on failure
* MT-Level: Safe.
*/
NEOERR *cCreate(pthread_cond_t *cond);
/*
* Function: cCreate - initialize a condition variable.
* Description: Initializes the condition variable <cond>.
* Input: cond - condition variable to initialize.
* Output: None.
* Return: STATUS_OK on success
* NERR_LOCK on failure
* MT-Level: Safe for unique <cond>.
*/
void cDestroy(pthread_cond_t *cond);
/*
* Function: cDestroy - destroy a condition variable.
* Description: Destroys the condition variable <cond> that was
* initialized by cCreate().
* Input: cond - condition variable to destroy.
* Output: None.
* Return: None.
* MT-Level: Safe for unique <cond>.
*/
NEOERR *cWait(pthread_cond_t *cond, pthread_mutex_t *mutex);
/*
* Function: cWait - wait a condition variable signal.
* Description: Waits for a signal on condition variable <cond>.
* The mutex <mutex> must be locked by the thread.
* Input: cond - condition variable to wait on.
* mutex - locked mutex to protect <cond>.
* Output: None.
* Return: STATUS_OK on success
* NERR_LOCK on failure
* MT-Level: Safe.
*/
NEOERR *cBroadcast(pthread_cond_t *cond);
/*
* Function: cBroadcast - broadcast signal to all waiting threads.
* Description: Broadcasts a signal to all threads waiting on condition
* variable <cond>.
* Input: cond - condition variable to broadcast on.
* Output: None.
* Return: STATUS_OK on success
* NERR_LOCK on failure
* MT-Level: Safe.
*/
NEOERR *cSignal(pthread_cond_t *cond);
/*
* Function: cSignal - send signal to one waiting thread.
* Description: Sends a signal to one thread waiting on condition
* variable <cond>.
* Input: cond - condition variable to send signal on.
* Output: None.
* Return: STATUS_OK on success
* NERR_LOCK on failure
* MT-Level: Safe.
*/
#endif /* HAVE_PTHREAD */
#endif /* __ULOCKS_H_ */
|