LibC: Implement pthread_rwlock

This uses the same dumb sched_yield instead of actually blocking :D
This commit is contained in:
2025-04-21 18:25:52 +03:00
parent 773b8de8ba
commit 1c88d0d7f7
3 changed files with 155 additions and 30 deletions

View File

@@ -34,8 +34,8 @@ typedef int pthread_barrier_t;
typedef int pthread_condattr_t;
typedef int pthread_cond_t;
typedef int pthread_rwlockattr_t;
typedef int pthread_rwlock_t;
typedef struct { int shared; } pthread_rwlockattr_t;
typedef struct { pthread_rwlockattr_t attr; unsigned lockers; unsigned writers; } pthread_rwlock_t;
#endif
#undef __need_pthread_types

View File

@@ -55,7 +55,7 @@ struct uthread
#define PTHREAD_COND_INITIALIZER (pthread_cond_t)0
#define PTHREAD_MUTEX_INITIALIZER (pthread_mutex_t){ { PTHREAD_MUTEX_DEFAULT, false }, 0, 0 }
#define PTHREAD_RWLOCK_INITIALIZER (pthread_rwlock_t)0
#define PTHREAD_RWLOCK_INITIALIZER (pthread_rwlock_t){ { false }, 0, 0 }
int pthread_atfork(void (*prepare)(void), void (*parent)(void), void(*child)(void));
int pthread_attr_destroy(pthread_attr_t* attr);