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
Convert GRAS pid from long int to int; setup a virtualization layer in XBT to choose...
[simgrid.git]
/
examples
/
gras
/
mutual_exclusion
/
simple_token
/
simple_token.c
diff --git
a/examples/gras/mutual_exclusion/simple_token/simple_token.c
b/examples/gras/mutual_exclusion/simple_token/simple_token.c
index
0ad688f
..
5f0db69
100644
(file)
--- a/
examples/gras/mutual_exclusion/simple_token/simple_token.c
+++ b/
examples/gras/mutual_exclusion/simple_token/simple_token.c
@@
-72,8
+72,7
@@
static int node_cb_stoken_handler(gras_msg_cb_ctx_t ctx, void *payload) {
/* 5. Send the token as payload of a stoken message to the successor */
TRY {
/* 5. Send the token as payload of a stoken message to the successor */
TRY {
- gras_msg_send(globals->tosuccessor,
- gras_msgtype_by_name("stoken"), &msg);
+ gras_msg_send(globals->tosuccessor, "stoken", &msg);
/* 6. Deal with errors */
} CATCH(e) {
/* 6. Deal with errors */
} CATCH(e) {
@@
-96,7
+95,7
@@
static int node_cb_stoken_handler(gras_msg_cb_ctx_t ctx, void *payload) {
}
/* 9. Tell GRAS that we consummed this message */
}
/* 9. Tell GRAS that we consummed this message */
- return
1
;
+ return
0
;
} /* end_of_node_cb_stoken_handler */
int node (int argc,char *argv[]) {
} /* end_of_node_cb_stoken_handler */
int node (int argc,char *argv[]) {
@@
-130,7
+129,7
@@
int node (int argc,char *argv[]) {
globals->tosuccessor = NULL;
if (!gras_os_getpid() % 100)
globals->tosuccessor = NULL;
if (!gras_os_getpid() % 100)
- INFO4("Launch node %
l
d (successor on %s:%d; listening on %d)",
+ INFO4("Launch node %d (successor on %s:%d; listening on %d)",
gras_os_getpid(), host,peerport, myport);
/* 4. Create my master socket for listening */
gras_os_getpid(), host,peerport, myport);
/* 4. Create my master socket for listening */
@@
-150,7
+149,7
@@
int node (int argc,char *argv[]) {
/* 8. One node has to create the token at startup.
It's specified by a command line argument */
/* 8. One node has to create the token at startup.
It's specified by a command line argument */
- if (argc >= 5 && !strncmp("--create-token", argv[4],strlen(
argv[4]
)))
+ if (argc >= 5 && !strncmp("--create-token", argv[4],strlen(
"--create-token"
)))
globals->create=1;
if (globals->create) {
globals->create=1;
if (globals->create) {
@@
-162,8
+161,7
@@
int node (int argc,char *argv[]) {
token, host, peerport);
TRY {
token, host, peerport);
TRY {
- gras_msg_send(globals->tosuccessor,
- gras_msgtype_by_name("stoken"), &token);
+ gras_msg_send(globals->tosuccessor, "stoken", &token);
} CATCH(e) {
RETHROW0("Unable to send the freshly created token: %s");
}
} CATCH(e) {
RETHROW0("Unable to send the freshly created token: %s");
}