Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix sem_init testing.
[simgrid.git] / src / xbt / xbt_os_thread.c
index 2b8326e..10f8266 100644 (file)
@@ -95,7 +95,7 @@ void xbt_os_thread_mod_preinit(void)
 
   thread_mod_inited = 1;
 
-#ifndef HAVE_SEM_WAIT
+#ifndef HAVE_SEM_INIT
   next_sem_ID_lock = xbt_os_mutex_init();
 #endif
 
@@ -113,7 +113,7 @@ void xbt_os_thread_mod_postexit(void)
   free(main_thread);
   main_thread = NULL;
   thread_mod_inited = 0;
-#ifndef HAVE_SEM_WAIT
+#ifndef HAVE_SEM_INIT
   xbt_os_mutex_destroy(next_sem_ID_lock);
 #endif
 
@@ -122,6 +122,12 @@ void xbt_os_thread_mod_postexit(void)
   __xbt_ex_terminate = &__xbt_ex_terminate_default;
 }
 
+int xbt_os_thread_atfork(void (*prepare)(void),
+                         void (*parent)(void), void (*child)(void))
+{
+  return pthread_atfork(prepare, parent, child);
+}
+
 static void *wrapper_start_routine(void *s)
 {
   xbt_os_thread_t t = s;
@@ -162,8 +168,8 @@ const char *xbt_os_thread_name(xbt_os_thread_t t)
 
 const char *xbt_os_thread_self_name(void)
 {
-  xbt_os_thread_t self = xbt_os_thread_self();
-  return self ? self->name : "main";
+  xbt_os_thread_t me = xbt_os_thread_self();
+  return me ? me->name : "main";
 }
 
 void xbt_os_thread_join(xbt_os_thread_t thread, void **thread_return)
@@ -618,6 +624,12 @@ void xbt_os_thread_mod_postexit(void)
            "TlsFree() failed to cleanup the thread submodule");
 }
 
+int xbt_os_thread_atfork(void (*prepare)(void),
+                         void (*parent)(void), void (*child)(void))
+{
+  return 0;
+}
+
 static DWORD WINAPI wrapper_start_routine(void *s)
 {
   xbt_os_thread_t t = (xbt_os_thread_t) s;