diff foosdk/sdk/pfc/synchro_nix.cpp @ 1:20d02a178406 default tip

*: check in everything else yay
author Paper <paper@tflc.us>
date Mon, 05 Jan 2026 02:15:46 -0500
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/foosdk/sdk/pfc/synchro_nix.cpp	Mon Jan 05 02:15:46 2026 -0500
@@ -0,0 +1,33 @@
+#include "pfc.h"
+
+#ifndef _WIN32
+
+namespace pfc {
+
+    void mutexBase::create( const pthread_mutexattr_t * attr ) {
+        if (pthread_mutex_init( &obj, attr) != 0) {
+            throw exception_bug_check();
+        }
+    }
+    void mutexBase::destroy() {
+        pthread_mutex_destroy( &obj );
+    }
+    void mutexBase::createRecur() {
+        mutexAttr a; a.setRecursive(); create(&a.attr);
+    }
+    void mutexBase::create( const mutexAttr & a ) {
+        create( & a.attr );
+    }
+    
+    void readWriteLockBase::create( const pthread_rwlockattr_t * attr ) {
+        if (pthread_rwlock_init( &obj, attr) != 0) {
+            throw exception_bug_check();
+        }
+    }
+    void readWriteLockBase::create( const readWriteLockAttr & a) {
+        create(&a.attr);
+    }
+
+}
+
+#endif // _WIN32