]> git.xonotic.org Git - xonotic/d0_blind_id.git/commitdiff
add a framework to define mutex functions
authorRudolf Polzer <divverent@xonotic.org>
Tue, 25 Oct 2011 12:31:52 +0000 (14:31 +0200)
committerRudolf Polzer <divverent@xonotic.org>
Tue, 25 Oct 2011 12:31:52 +0000 (14:31 +0200)
d0.c
d0.h

diff --git a/d0.c b/d0.c
index 29b0aed1e76de5458941551d3400ee25fc3f7af8..fccc4e51326645b85f8725b9e8dc7c452cdbe5c2 100644 (file)
--- a/d0.c
+++ b/d0.c
@@ -45,3 +45,25 @@ const char *d0_bsd_license_notice = "\n"
 
 void *(*d0_malloc)(size_t len) = malloc;
 void (*d0_free)(void *p) = free;
 
 void *(*d0_malloc)(size_t len) = malloc;
 void (*d0_free)(void *p) = free;
+
+static void *dummy = (void *) 1; // some dummy non-NULL pointer
+static void *dummy_createmutex(void)
+{
+       return NULL;
+}
+static void dummy_destroymutex(void *m)
+{
+}
+static int dummy_lockmutex(void *m)
+{
+       return 0;
+}
+static int dummy_unlockmutex(void *m)
+{
+       return 0;
+}
+
+void *(*d0_createmutex)(void) = dummy_createmutex;
+void (*d0_destroymutex)(void *) = dummy_destroymutex;
+int (*d0_lockmutex)(void *) = dummy_lockmutex;
+int (*d0_unlockmutex)(void *) = dummy_unlockmutex;
diff --git a/d0.h b/d0.h
index 9a7b912057b836675f4e24f08514cad53fa46d2a..bd0776539c898e20ccbb1c4a8bbc19df78374196 100644 (file)
--- a/d0.h
+++ b/d0.h
 
 extern void *(*d0_malloc)(size_t len);
 extern void (*d0_free)(void *p);
 
 extern void *(*d0_malloc)(size_t len);
 extern void (*d0_free)(void *p);
+
+extern void *(*d0_createmutex)(void);
+extern void (*d0_destroymutex)(void *);
+extern int (*d0_lockmutex)(void *); // zero on success
+extern int (*d0_unlockmutex)(void *); // zero on success
+
 extern const char *d0_bsd_license_notice;
 
 #endif
 extern const char *d0_bsd_license_notice;
 
 #endif