/usr/include/spooles/Lock/Lock.h is in libspooles-dev 2.2-9.
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 | /* Lock.h */
#include "../cfiles.h"
#define TT_NONE 0
#define TT_SOLARIS 1
#define TT_POSIX 2
#define THREAD_TYPE TT_POSIX
#if THREAD_TYPE == TT_SOLARIS
#include <thread.h>
#include <synch.h>
#endif
#if THREAD_TYPE == TT_POSIX
#include <pthread.h>
#endif
#define NO_LOCK 0
#define LOCK_IN_PROCESS 1
#define LOCK_OVER_ALL_PROCESSES 2
/*--------------------------------------------------------------------*/
/*
---------------------------------------------------------
this structure contains a lock,
presently solaris and posix thread packages are supported
mutex -- pointer to a lock
nlocks -- number of locks
nunlocks -- number of unlocks
created -- 97aug22, cca
---------------------------------------------------------
*/
typedef struct _Lock Lock ;
struct _Lock {
#if THREAD_TYPE == TT_SOLARIS
mutex_t *mutex ;
#endif
#if THREAD_TYPE == TT_POSIX
pthread_mutex_t *mutex ;
#endif
#if THREAD_TYPE == TT_NONE
void *mutex ;
#endif
int nlocks ;
int nunlocks ;
} ;
/*--------------------------------------------------------------------*/
/*
------------------------------------------------------------------------
----- method found in basics.c -----------------------------------------
------------------------------------------------------------------------
*/
/*
-----------------------
simplest constructor
created -- 97aug22, cca
-----------------------
*/
Lock *
Lock_new (
void
) ;
/*
-----------------------
set the default fields
created -- 97aug22, cca
-----------------------
*/
void
Lock_setDefaultFields (
Lock *lock
) ;
/*
--------------------------------------------------
clear the data fields, releasing allocated storage
created -- 97aug22, cca
--------------------------------------------------
*/
void
Lock_clearData (
Lock *lock
) ;
/*
------------------------------------------
destructor, free's the object and its data
created -- 97aug22, cca
------------------------------------------
*/
void
Lock_free (
Lock *lock
) ;
/*--------------------------------------------------------------------*/
/*
------------------------------------------------------------------------
----- method found in init.c -------------------------------------------
------------------------------------------------------------------------
*/
/*
------------------------------------------------------------------
purpose -- basic initializer
lockflag -- flag to specify lock status
SOLARIS:
lockflag = 0 --> mutex lock is not allocated or initialized
lockflag = 1 --> mutex lock is allocated and it can synchronize
only threads in this process.
lockflag = 2 --> mutex lock is allocated and it can synchronize
only threads in this and other processes.
POSIX:
lockflag = 0 --> mutex lock is not allocated or initialized
lockflag = 1 --> mutex lock is allocated and it can synchronize
only threads in this process.
created -- 97aug22, cca
------------------------------------------------------------------
*/
void
Lock_init (
Lock *lock,
int lockflag
) ;
/*--------------------------------------------------------------------*/
/*
------------------------------------------------------------------------
----- method found in util.c -------------------------------------------
------------------------------------------------------------------------
*/
/*
-----------------------
lock the lock
created -- 97aug22, cca
-----------------------
*/
void
Lock_lock (
Lock *lock
) ;
/*
-----------------------
unlock the lock
created -- 97aug22, cca
-----------------------
*/
void
Lock_unlock (
Lock *lock
) ;
/*--------------------------------------------------------------------*/
/*--------------------------------------------------------------------*/
|