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
Merge branch 'master' of git+ssh://scm.gforge.inria.fr//gitroot/simgrid/simgrid
[simgrid.git]
/
teshsuite
/
msg
/
pid.c
diff --git
a/teshsuite/msg/pid.c
b/teshsuite/msg/pid.c
index 1f04fb2a54d81d3e8f1fbe73c82ec1a60ab6955e..54c89014ad8b8507d47e659ce4f501e227de0006 100644
(file)
--- a/
teshsuite/msg/pid.c
+++ b/
teshsuite/msg/pid.c
@@
-9,15
+9,16
@@
XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test,
"Messages specific for this msg example");
XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test,
"Messages specific for this msg example");
-char* mailbox = "mailbox";
+c
onst c
har* mailbox = "mailbox";
#define task_comp_size 1000
#define task_comm_size 100000
#define task_comp_size 1000
#define task_comm_size 100000
-int onexit(void* data){
- XBT_INFO("Process \"%d\" killed.", *((int*)data));
+static int onexit(void* data){
+ XBT_INFO("Process \"%d\" killed.", *((int*)data));
+ return 0;
}
}
-int sendpid(int argc, char *argv[])
+
static
int sendpid(int argc, char *argv[])
{
int pid = MSG_process_self_PID();
MSG_process_on_exit(onexit, &pid);
{
int pid = MSG_process_self_PID();
MSG_process_on_exit(onexit, &pid);
@@
-26,19
+27,22
@@
int sendpid(int argc, char *argv[])
MSG_task_send(task, mailbox);
XBT_INFO("Send of pid \"%d\" done.", pid);
MSG_process_suspend(MSG_process_self());
MSG_task_send(task, mailbox);
XBT_INFO("Send of pid \"%d\" done.", pid);
MSG_process_suspend(MSG_process_self());
+ return 0;
}
}
-int killall(int argc, char *argv[]){
+
static
int killall(int argc, char *argv[]){
msg_task_t task = NULL;
_XBT_GNUC_UNUSED int res;
int i;
for (i=0; i<3;i++) {
res = MSG_task_receive(&(task), mailbox);
msg_task_t task = NULL;
_XBT_GNUC_UNUSED int res;
int i;
for (i=0; i<3;i++) {
res = MSG_task_receive(&(task), mailbox);
- int pid = *((int*)MSG_task_get_data(task));
+ int pid = *(int*)MSG_task_get_data(task);
+ MSG_task_destroy(task);
XBT_INFO("Killing process \"%d\".", pid);
MSG_process_kill(MSG_process_from_PID(pid));
task = NULL;
}
XBT_INFO("Killing process \"%d\".", pid);
MSG_process_kill(MSG_process_from_PID(pid));
task = NULL;
}
+ return 0;
}
/** Main function */
}
/** Main function */
@@
-52,10
+56,10
@@
int main(int argc, char *argv[])
MSG_function_register("sendpid", &sendpid);
MSG_function_register("killall", &killall);
MSG_function_register("sendpid", &sendpid);
MSG_function_register("killall", &killall);
- MSG_process_killall(atoi(argv[
2
]));
+ MSG_process_killall(atoi(argv[
3
]));
MSG_create_environment(argv[1]);
MSG_create_environment(argv[1]);
- MSG_launch_application(argv[
1
]);
+ MSG_launch_application(argv[
2
]);
res = MSG_main();
if (res == MSG_OK)
res = MSG_main();
if (res == MSG_OK)