LibC: Make pthread_barrier safe
It used to deadlock and it was not safe if more threads than the target were attempting to wait on it.
This commit is contained in:
@@ -28,17 +28,6 @@ typedef struct
|
||||
unsigned lock_depth;
|
||||
} pthread_mutex_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int shared;
|
||||
} pthread_barrierattr_t;
|
||||
typedef struct
|
||||
{
|
||||
pthread_barrierattr_t attr;
|
||||
unsigned target;
|
||||
unsigned waiting;
|
||||
} pthread_barrier_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int clock;
|
||||
@@ -56,6 +45,20 @@ typedef struct
|
||||
struct _pthread_cond_block* block_list;
|
||||
} pthread_cond_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int shared;
|
||||
} pthread_barrierattr_t;
|
||||
typedef struct
|
||||
{
|
||||
pthread_barrierattr_t attr;
|
||||
pthread_mutex_t lock;
|
||||
pthread_cond_t cond;
|
||||
unsigned target;
|
||||
unsigned waiting;
|
||||
unsigned generation;
|
||||
} pthread_barrier_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int shared;
|
||||
|
||||
Reference in New Issue
Block a user