From: Rudolf Polzer Date: Tue, 25 Oct 2011 12:31:52 +0000 (+0200) Subject: add a framework to define mutex functions X-Git-Tag: v0.5~18 X-Git-Url: http://git.xonotic.org/?p=xonotic%2Fd0_blind_id.git;a=commitdiff_plain;h=6cfebb6867fe402171245a296f5d918a3ded75e0 add a framework to define mutex functions --- diff --git a/d0.c b/d0.c index 29b0aed..fccc4e5 100644 --- 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; + +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 9a7b912..bd07765 100644 --- a/d0.h +++ b/d0.h @@ -44,6 +44,12 @@ 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