ref: 55f583f9345fc08ced786445266ddc3592adbc86
parent: a7986315ccda3f5c8af795365cef28a4450a6d72
parent: f9f996b3e2012bcc30e5bdf7a2297b4a46016905
author: James Zern <jzern@google.com>
date: Tue Jul 29 15:36:11 EDT 2014
Merge "vpx_once: implement once() for OS/2"
--- a/vpx_ports/vpx_once.h
+++ b/vpx_ports/vpx_once.h
@@ -73,6 +73,33 @@
}
+#elif CONFIG_MULTITHREAD && defined(__OS2__)
+#define INCL_DOS
+#include <os2.h>
+static void once(void (*func)(void))
+{
+ static int done;
+
+ /* If the initialization is complete, return early. */
+ if(done)
+ return;
+
+ /* Causes all other threads in the process to block themselves
+ * and give up their time slice.
+ */
+ DosEnterCritSec();
+
+ if (!done)
+ {
+ func();
+ done = 1;
+ }
+
+ /* Restores normal thread dispatching for the current process. */
+ DosExitCritSec();
+}
+
+
#elif CONFIG_MULTITHREAD && HAVE_PTHREAD_H
#include <pthread.h>
static void once(void (*func)(void))
--
⑨