LibC: Implement pthread_barrier

This is not fully working but should be fine for most cases
This commit is contained in:
2025-04-21 19:53:38 +03:00
parent 60cb392e97
commit 2a5921b9c9
3 changed files with 80 additions and 3 deletions

View File

@@ -28,8 +28,8 @@ typedef pthread_t pthread_spinlock_t;
typedef struct { int type; int shared; } pthread_mutexattr_t;
typedef struct { pthread_mutexattr_t attr; pthread_t locker; unsigned lock_depth; } pthread_mutex_t;
typedef int pthread_barrierattr_t;
typedef int pthread_barrier_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; int shared; } pthread_condattr_t;
struct _pthread_cond_block { struct _pthread_cond_block* next; int signaled; };

View File

@@ -24,7 +24,6 @@ struct uthread
uintptr_t dtv[];
};
#define PTHREAD_BARRIER_SERIAL_THREAD 1
#define PTHREAD_CANCEL_ASYNCHRONOUS 2
#define PTHREAD_CANCEL_ENABLE 3
#define PTHREAD_CANCEL_DEFERRED 4
@@ -40,6 +39,8 @@ struct uthread
#define PTHREAD_SCOPE_PROCESS 23
#define PTHREAD_SCOPE_SYSTEM 24
#define PTHREAD_BARRIER_SERIAL_THREAD 1
#define PTHREAD_ONCE_INIT 0
#define PTHREAD_PROCESS_SHARED 0