Browse Source

LibPthread: Implement pthread_mutexattr_init() and _destroy()

Andreas Kling 5 năm trước cách đây
mục cha
commit
9ddfe694f2

+ 3 - 1
Libraries/LibC/sys/types.h

@@ -65,7 +65,9 @@ typedef void* pthread_key_t;
 typedef void* pthread_once_t;
 typedef void* pthread_once_t;
 typedef uint32_t pthread_mutex_t;
 typedef uint32_t pthread_mutex_t;
 typedef void* pthread_attr_t;
 typedef void* pthread_attr_t;
-typedef void* pthread_mutexattr_t;
+typedef struct __pthread_mutexattr_t {
+    int type;
+} pthread_mutexattr_t;
 
 
 typedef struct __pthread_cond_t {
 typedef struct __pthread_cond_t {
     void* storage;
     void* storage;

+ 11 - 0
Libraries/LibPthread/pthread.cpp

@@ -125,6 +125,17 @@ int pthread_mutex_unlock(pthread_mutex_t* mutex)
     return 0;
     return 0;
 }
 }
 
 
+int pthread_mutexattr_init(pthread_mutexattr_t* attr)
+{
+    attr->type = PTHREAD_MUTEX_NORMAL;
+    return 0;
+}
+
+int pthread_mutexattr_destroy(pthread_mutexattr_t*)
+{
+    return 0;
+}
+
 int pthread_attr_init(pthread_attr_t* attributes)
 int pthread_attr_init(pthread_attr_t* attributes)
 {
 {
     auto* impl = new PthreadAttrImpl {};
     auto* impl = new PthreadAttrImpl {};