Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
remove backtrace dumps
[simgrid.git] / src / xbt / xbt_rl_synchro.c
index 29c7618..3aaca7d 100644 (file)
@@ -30,21 +30,30 @@ typedef struct s_xbt_thread_ {
 
 static void *xbt_thread_create_wrapper(void *p)  {   
    xbt_thread_t t = (xbt_thread_t)p;
+   DEBUG1("I'm thread %p",p);
    (*t->code)(t->userparam);
    return NULL;
 }
 
 
-xbt_thread_t xbt_thread_create(void_f_pvoid_t* code, void* param) {
+xbt_thread_t xbt_thread_create(const char*name,void_f_pvoid_t* code, void* param) {
 
    xbt_thread_t res = xbt_new0(s_xbt_thread_t,1);
    res->userparam = param;
    res->code = code;
-   res->os_thread = xbt_os_thread_create(xbt_thread_create_wrapper,res);
    DEBUG1("Create thread %p",res);
+   res->os_thread = xbt_os_thread_create(name,xbt_thread_create_wrapper,res);
    return res;
 }
 
+const char* xbt_thread_name(xbt_thread_t t) {
+   return xbt_os_thread_name(t->os_thread);
+}
+
+const char* xbt_thread_self_name(void) {
+   return xbt_os_thread_self_name();
+}
+
 void 
 xbt_thread_join(xbt_thread_t thread) {
    DEBUG1("Join thread %p",thread);
@@ -57,7 +66,7 @@ void xbt_thread_exit() {
 }
 
 xbt_thread_t xbt_thread_self(void) {
-   return (xbt_thread_t)xbt_os_thread_getparam();
+   return (xbt_thread_t)xbt_os_thread_self();
 }
 
 void xbt_thread_yield(void) {
@@ -134,6 +143,7 @@ void xbt_cond_wait(xbt_cond_t cond, xbt_mutex_t mutex) {
 void xbt_cond_timedwait(xbt_cond_t cond, xbt_mutex_t mutex, double delay) {
    DEBUG3("Wait cond %p, mutex %p for %f sec", cond, mutex,delay);
    xbt_os_cond_timedwait( (xbt_os_cond_t)cond, (xbt_os_mutex_t)mutex, delay );
+   DEBUG3("Done waiting cond %p, mutex %p for %f sec", cond, mutex, delay);
 }
 
 void xbt_cond_signal(xbt_cond_t cond) {