Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
name threads to easy debugging
authormquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Mon, 6 Aug 2007 18:21:05 +0000 (18:21 +0000)
committermquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Mon, 6 Aug 2007 18:21:05 +0000 (18:21 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@3996 48e7efb5-ca39-0410-a469-dd3cf9ba447f

src/xbt/dynar.c
src/xbt/xbt_os_thread_stubs.c
src/xbt/xbt_sg_synchro.c

index df177bf..964f92d 100644 (file)
@@ -1166,8 +1166,8 @@ XBT_TEST_UNIT("synchronized int",test_dynar_sync_int,"Synchronized dynars of int
    
    xbt_test_add0("==== Have a pusher and a popper on the dynar");
    d=xbt_dynar_new_sync(sizeof(int),NULL);
-   pusher = xbt_thread_create(pusher_f,d);
-   poper = xbt_thread_create(poper_f,d);
+   pusher = xbt_thread_create("pusher",pusher_f,d);
+   poper = xbt_thread_create("poper",poper_f,d);
    xbt_thread_join(pusher);
    xbt_thread_join(poper);
    xbt_dynar_free(&d);
index ca6ca8e..745e630 100644 (file)
@@ -30,7 +30,7 @@ void xbt_os_thread_mod_exit(void) {}
 
 /* Main functions */
 
-xbt_os_thread_t xbt_os_thread_create(pvoid_f_pvoid_t start_routine,void* param) {
+xbt_os_thread_t xbt_os_thread_create(const char*name,pvoid_f_pvoid_t start_routine,void* param) {
    xbt_backtrace_display_current();
    xbt_die("No pthread in SG when compiled against the ucontext (xbt_os_thread_create)");
 }
index ee39fd4..3788d37 100644 (file)
@@ -21,6 +21,7 @@
 /* the implementation would be cleaner (and faster) with ELF symbol aliasing */
 
 typedef struct s_xbt_thread_ {
+   char *name;
    smx_process_t s_process;
    void_f_pvoid_t *code;
    void *userparam;
@@ -34,17 +35,18 @@ static int xbt_thread_create_wrapper(int argc, char *argv[]) {
    return 0;
 }
 
-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->name = xbt_strdup(name);
    res->userparam = param;
    res->code = code;
    res->father_data = SIMIX_process_get_data(SIMIX_process_self());
-   char*name = bprintf("%s#%p",SIMIX_process_get_name(SIMIX_process_self()), param);
+//   char*name = bprintf("%s#%p",SIMIX_process_get_name(SIMIX_process_self()), param);
    res->s_process = SIMIX_process_create(name, 
                                         xbt_thread_create_wrapper, res,
                                         SIMIX_host_get_name(SIMIX_host_self()),
                                         0, NULL);
-   free(name);
+//   free(name);
    return res;
 }