Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
A distraction, the SIMIX_process_create() function takes only six parameters.
[simgrid.git] / src / xbt / xbt_sg_synchro.c
index 306436d..bc80b82 100644 (file)
@@ -25,7 +25,7 @@ typedef struct s_xbt_thread_ {
    smx_process_t s_process;
    void_f_pvoid_t code;
    void *userparam;
-        void *father_data;
+   void *father_data;
 } s_xbt_thread_t;
 
 static int xbt_thread_create_wrapper(int argc, char *argv[]) {
@@ -45,7 +45,7 @@ xbt_thread_t xbt_thread_create(const char*name,void_f_pvoid_t code, void* param)
    res->s_process = SIMIX_process_create(name, 
                                         xbt_thread_create_wrapper, res,
                                         SIMIX_host_get_name(SIMIX_host_self()),
-                                        0, NULL,/*props*/NULL);
+                                        0,/*props*/NULL);
 //   free(name);
    return res;
 }
@@ -55,7 +55,8 @@ const char* xbt_thread_name(xbt_thread_t t) {
 }
 
 const char* xbt_thread_self_name(void) {
-   return xbt_thread_self()->name;
+   xbt_thread_t me = xbt_thread_self();
+   return me ? me->name : "maestro";
 }
 
 
@@ -77,7 +78,8 @@ void xbt_thread_exit() {
 }
 
 xbt_thread_t xbt_thread_self(void) {
-   return SIMIX_process_get_data(SIMIX_process_self());
+   smx_process_t p = SIMIX_process_self();
+   return p ? SIMIX_process_get_data(p) : NULL;
 }
 
 void xbt_thread_yield(void) {