GThread posix: switch to Windows ABI

Modify the POSIX implementation of the synchronisation primatives to use
the same ABI as Windows: one pointer for each type.

This frees us from having to #include <pthread.h> and avoids the problem
with pthread_rwlock_t not being defined under certain compiler defines.

A few more changes are expected to the ABI -- they will be committed
separately.

https://bugzilla.gnome.org/show_bug.cgi?id=659866
This commit is contained in:
Ryan Lortie
2011-10-02 20:43:28 -04:00
parent 151756631d
commit e081eadda5
2 changed files with 152 additions and 75 deletions

View File

@@ -59,8 +59,6 @@ typedef struct _GCond GCond;
typedef struct _GPrivate GPrivate;
typedef struct _GStaticPrivate GStaticPrivate;
#ifdef G_OS_WIN32
#define G_MUTEX_INIT { NULL }
struct _GMutex
{
@@ -78,33 +76,6 @@ struct _GCond
{
gpointer impl;
};
#else
#include <pthread.h>
#ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP
#define G_MUTEX_INIT { PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP }
#else
#define G_MUTEX_INIT { PTHREAD_MUTEX_INITIALIZER }
#endif
struct _GMutex
{
pthread_mutex_t impl;
};
#define G_RW_LOCK_INIT { PTHREAD_RWLOCK_INITIALIZER }
struct _GRWLock
{
pthread_rwlock_t impl;
};
#define G_COND_INIT { PTHREAD_COND_INITIALIZER }
struct _GCond
{
pthread_cond_t impl;
};
#endif
#define G_REC_MUTEX_INIT { NULL }
struct _GRecMutex