1
#ifndef _SGE_LOCK_FIFO_H_
2
#define _SGE_LOCK_FIFO_H_
6
#include "basis_types.h"
8
#include "lck/sge_lock.h"
10
typedef struct sge_fifo_elem_t__ {
12
* is the waiting thread a reader or writer
17
* has this thread already been signaled
22
* condition to wakeup a waiting thread
27
typedef struct sge_fifo_rw_lock_t__ {
29
* mutex to guard this structure
31
pthread_mutex_t mutex;
34
* condition to wakeup a waiting thread which got not
35
* no position in the queue of waiting threads
40
* fifo array where information about waiting threads is stored.
42
sge_fifo_elem_t *array;
45
* position of the next thread which gets the lock
50
* position in the array where the next thread will be placed which has to wait
60
* number of reader threads currently active
65
* number of waiting threads in the queue which try to get a read lock
70
* number of writer threads currently active (maximum is 1)
75
* number of waiting threads in the queue which try to get the write lock
80
* number of threads which do neither get a lock nor get a free position in the array
85
* number of waiting threads which have been signaled so that they wake up (maximum is 1)
91
sge_fifo_lock_init(sge_fifo_rw_lock_t *lock);
94
sge_fifo_lock(sge_fifo_rw_lock_t *lock, bool is_reader);
97
sge_fifo_ulock(sge_fifo_rw_lock_t *lock, bool is_reader);
100
sge_fifo_debug(sge_locktype_t aType);
103
sge_debug_time(sge_locktype_t aType);