gusimplewhiteboard
guWhiteboard_gugenericwhiteboardobject.cpp
Go to the documentation of this file.
1
14
15#include <stdlib.h>
16
17static void create_guWhiteboard_singleton_whiteboard(void *);
18
19static gu_simple_whiteboard_descriptor *guWhiteboard_whiteboard_descriptor;
20
21static void create_guWhiteboard_singleton_whiteboard(void *)
22{
23 const char *name = "guWhiteboard";
24
25#ifndef GSW_IOS_DEVICE
26 const char *env = getenv(GSW_DEFAULT_ENV);
27 if (env && *env) name = env;
28#endif
29
30//taken from gusimplewhiteboard.c, should we make this from a hash of the whiteboard name?
31#define SEMAPHORE_MAGIC_KEY 4242
32
33 guWhiteboard_whiteboard_descriptor = gsw_new_custom_whiteboard(
34 name,
38 );
39}
40
42{
43#ifdef WITHOUT_LIBDISPATCH // not thread-safe without libdispatch!
44 if (!guWhiteboard_whiteboard_descriptor)
45 {
46 guWhiteboard_whiteboard_descriptor = (gu_simple_whiteboard_descriptor *)~0;
47 create_guWhiteboard_singleton_whiteboard(NULLPTR);
48 }
49#else
50 static dispatch_once_t onceToken;
51 dispatch_once_f(&onceToken, NULLPTR, create_guWhiteboard_singleton_whiteboard);
52#endif
53 return guWhiteboard_whiteboard_descriptor;
54}
gu_simple_whiteboard_descriptor * get_guWhiteboard_singleton_whiteboard(void)
/file guWhiteboard_gugenericwhiteboardobject.h
#define SEMAPHORE_MAGIC_KEY
gu_simple_whiteboard_descriptor * gsw_new_custom_whiteboard(const char *name, const char *message_names[], int num_messages, int semaphore_magic_key)
Access a named, custom whiteboard.
#define GSW_DEFAULT_ENV
environment variable containing the default whiteboard file name
#define WB_NUM_TYPES_DEFINED
const char * wb_types_stringValues[183]
the underlying whiteboard object