A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
give a useful name to threads (father's name + pointer 'arg' passed to the creation...
[simgrid.git]
/
src
/
xbt
/
xbt_sg_synchro.c
diff --git
a/src/xbt/xbt_sg_synchro.c
b/src/xbt/xbt_sg_synchro.c
index
ee00c07
..
ee39fd4
100644
(file)
--- a/
src/xbt/xbt_sg_synchro.c
+++ b/
src/xbt/xbt_sg_synchro.c
@@
-24,10
+24,12
@@
typedef struct s_xbt_thread_ {
smx_process_t s_process;
void_f_pvoid_t *code;
void *userparam;
smx_process_t s_process;
void_f_pvoid_t *code;
void *userparam;
+ void *father_data;
} s_xbt_thread_t;
static int xbt_thread_create_wrapper(int argc, char *argv[]) {
xbt_thread_t t = (xbt_thread_t)SIMIX_process_get_data(SIMIX_process_self());
} s_xbt_thread_t;
static int xbt_thread_create_wrapper(int argc, char *argv[]) {
xbt_thread_t t = (xbt_thread_t)SIMIX_process_get_data(SIMIX_process_self());
+ SIMIX_process_set_data(SIMIX_process_self(),t->father_data);
(*t->code)(t->userparam);
return 0;
}
(*t->code)(t->userparam);
return 0;
}
@@
-36,10
+38,13
@@
xbt_thread_t xbt_thread_create(void_f_pvoid_t* code, void* param) {
xbt_thread_t res = xbt_new0(s_xbt_thread_t,1);
res->userparam = param;
res->code = code;
xbt_thread_t res = xbt_new0(s_xbt_thread_t,1);
res->userparam = param;
res->code = code;
- res->s_process = SIMIX_process_create(NULL,
+ res->father_data = SIMIX_process_get_data(SIMIX_process_self());
+ 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);
xbt_thread_create_wrapper, res,
SIMIX_host_get_name(SIMIX_host_self()),
0, NULL);
+ free(name);
return res;
}
return res;
}
@@
-49,13
+54,15
@@
xbt_thread_join(xbt_thread_t thread) {
}
void
}
void
-xbt_thread_
destroy
(xbt_thread_t thread) {
+xbt_thread_
cancel
(xbt_thread_t thread) {
SIMIX_process_kill(thread->s_process);
free(thread);
}
void xbt_thread_exit() {
SIMIX_process_kill(thread->s_process);
free(thread);
}
void xbt_thread_exit() {
- xbt_thread_destroy(xbt_thread_self());
+ xbt_thread_t me=SIMIX_process_get_data(SIMIX_process_self());
+ SIMIX_process_kill(me->s_process);
+ free(me);
}
xbt_thread_t xbt_thread_self(void) {
}
xbt_thread_t xbt_thread_self(void) {