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
|
typedef struct {
PyObject_HEAD
key_t key;
int id;
short op_flags;
} Semaphore;
/* Object methods */
PyObject *Semaphore_new(PyTypeObject *type, PyObject *, PyObject *);
int Semaphore_init(Semaphore *, PyObject *, PyObject *);
void Semaphore_dealloc(Semaphore *);
PyObject *Semaphore_enter(Semaphore *);
PyObject *Semaphore_exit(Semaphore *, PyObject *);
PyObject *Semaphore_P(Semaphore *, PyObject *, PyObject *);
PyObject *Semaphore_acquire(Semaphore *, PyObject *, PyObject *);
PyObject *Semaphore_V(Semaphore *, PyObject *, PyObject *);
PyObject *Semaphore_release(Semaphore *, PyObject *, PyObject *);
PyObject *Semaphore_Z(Semaphore *, PyObject *, PyObject *);
PyObject *Semaphore_remove(Semaphore *);
/* Object attributes (read-write & read-only) */
PyObject *sem_get_value(Semaphore *);
int sem_set_value(Semaphore *self, PyObject *py_value);
PyObject *sem_get_block(Semaphore *);
int sem_set_block(Semaphore *self, PyObject *py_value);
PyObject *sem_get_mode(Semaphore *);
int sem_set_mode(Semaphore *, PyObject *);
PyObject *sem_get_undo(Semaphore *);
int sem_set_undo(Semaphore *self, PyObject *py_value);
PyObject *sem_get_uid(Semaphore *);
int sem_set_uid(Semaphore *, PyObject *);
PyObject *sem_get_gid(Semaphore *);
int sem_set_gid(Semaphore *, PyObject *);
PyObject *sem_get_key(Semaphore *);
PyObject *sem_get_c_uid(Semaphore *);
PyObject *sem_get_c_gid(Semaphore *);
PyObject *sem_get_last_pid(Semaphore *);
PyObject *sem_get_waiting_for_nonzero(Semaphore *);
PyObject *sem_get_waiting_for_zero(Semaphore *);
PyObject *sem_get_o_time(Semaphore *);
PyObject *sem_str(Semaphore *);
PyObject *sem_repr(Semaphore *);
/* Utility functions */
PyObject *sem_remove(int);
|