18 #include <ndb_global.h>
24 NdbMutex *g_ndb_connection_mutex = NULL;
27 extern void destroy_event_logger(
class EventLogger ** g_eventLogger);
31 int g_ndb_init_need_monotonic = 0;
33 static int ndb_init_called = 0;
35 extern "C" void NdbCondition_initialize(
int need_monotonic);
36 extern "C" void NdbTick_Init(
int need_monotonic);
37 extern "C" int NdbThread_Init();
38 extern "C" void NdbThread_End();
39 extern void NdbOut_Init();
48 if (!g_ndb_connection_mutex)
49 g_ndb_connection_mutex = NdbMutex_Create();
51 g_eventLogger = create_event_logger();
52 if ((g_ndb_connection_mutex == NULL) || (g_eventLogger == NULL))
55 const char* err =
"ndb_init() failed - exit\n";
56 int res = write(2, err, strlen(err));
63 g_ndb_init_need_monotonic = 1;
65 NdbTick_Init(g_ndb_init_need_monotonic);
66 NdbCondition_initialize(g_ndb_init_need_monotonic);
73 if (ndb_init_called == 0)
78 const char* err =
"my_init() failed - exit\n";
79 int res = write(2, err, strlen(err));
92 if (g_ndb_connection_mutex)
94 NdbMutex_Destroy(g_ndb_connection_mutex);
95 g_ndb_connection_mutex=NULL;
98 destroy_event_logger(&g_eventLogger);
104 if (ndb_init_called == 1)