Separated the public interfaces of the threading primitives.

This commit is contained in:
Tobias Brunner
2009-12-23 17:01:53 +01:00
parent f36143b0ba
commit eba64cef41
50 changed files with 361 additions and 371 deletions
+62 -1
View File
@@ -17,13 +17,74 @@
#define _GNU_SOURCE
#include <pthread.h>
#include <threading.h>
#include <library.h>
#include <debug.h>
#include "rwlock.h"
#include "condvar.h"
#include "mutex.h"
#include "lock_profiler.h"
typedef struct private_rwlock_t private_rwlock_t;
/**
* private data of rwlock
*/
struct private_rwlock_t {
/**
* public functions
*/
rwlock_t public;
#ifdef HAVE_PTHREAD_RWLOCK_INIT
/**
* wrapped pthread rwlock
*/
pthread_rwlock_t rwlock;
#else
/**
* mutex to emulate a native rwlock
*/
mutex_t *mutex;
/**
* condvar to handle writers
*/
condvar_t *writers;
/**
* condvar to handle readers
*/
condvar_t *readers;
/**
* number of waiting writers
*/
u_int waiting_writers;
/**
* number of readers holding the lock
*/
u_int reader_count;
/**
* current writer thread, if any
*/
pthread_t writer;
#endif /* HAVE_PTHREAD_RWLOCK_INIT */
/**
* profiling info, if enabled
*/
lock_profile_t profile;
};
#ifdef HAVE_PTHREAD_RWLOCK_INIT
/**