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
chainsend: decrease message size, it was actually too big for no good reason
[simgrid.git]
/
examples
/
xbt
/
sem_sched.c
diff --git
a/examples/xbt/sem_sched.c
b/examples/xbt/sem_sched.c
index
7ae8b7d
..
337d8c5
100644
(file)
--- a/
examples/xbt/sem_sched.c
+++ b/
examples/xbt/sem_sched.c
@@
-17,14
+17,14
@@
XBT_LOG_NEW_DEFAULT_CATEGORY(sem_sched,
"Messages specific for this sem example");
#ifndef ENOBUFS
"Messages specific for this sem example");
#ifndef ENOBUFS
-#define ENOBUFS
1024
+#define ENOBUFS 1024
#endif
#endif
-#define CTX_MAX
((unsigned int)1000)
+#define CTX_MAX ((unsigned int)1000)
-#define MAX_ARG
30
-#define MAX_ARGS
10
+#define MAX_ARG 30
+#define MAX_ARGS 10
typedef int (*pfn_func_t) (int, char **);
typedef int (*pfn_func_t) (int, char **);
@@
-95,7
+95,7
@@
int main(int argc, char *argv[])
xbt_init(&argc, argv);
if (argc != 2) {
xbt_init(&argc, argv);
if (argc != 2) {
-
INFO1
("Usage: %s job count", argv[0]);
+
XBT_INFO
("Usage: %s job count", argv[0]);
exit(EXIT_FAILURE);
}
exit(EXIT_FAILURE);
}
@@
-106,7
+106,7
@@
int main(int argc, char *argv[])
sched = sched_new(size);
if (!sched) {
sched = sched_new(size);
if (!sched) {
-
INFO1
("sched_new() failed : errno %d", errno);
+
XBT_INFO
("sched_new() failed : errno %d", errno);
exit(EXIT_FAILURE);
}
exit(EXIT_FAILURE);
}
@@
-126,28
+126,28
@@
int main(int argc, char *argv[])
/* initialize the scheduler */
if (sched_init(sched) < 0) {
sched_free(&sched);
/* initialize the scheduler */
if (sched_init(sched) < 0) {
sched_free(&sched);
-
INFO1
("sched_init() failed : errno %d\n", errno);
+
XBT_INFO
("sched_init() failed : errno %d\n", errno);
exit(EXIT_FAILURE);
}
/* schedule the jobs */
if (sched_schedule(sched) < 0) {
sched_free(&sched);
exit(EXIT_FAILURE);
}
/* schedule the jobs */
if (sched_schedule(sched) < 0) {
sched_free(&sched);
-
INFO1
("sched_init() failed : errno %d", errno);
+
XBT_INFO
("sched_init() failed : errno %d", errno);
exit(EXIT_FAILURE);
}
/* cleanup */
if (sched_clean(sched) < 0) {
sched_free(&sched);
exit(EXIT_FAILURE);
}
/* cleanup */
if (sched_clean(sched) < 0) {
sched_free(&sched);
-
INFO1
("sched_init() failed : errno %d", errno);
+
XBT_INFO
("sched_init() failed : errno %d", errno);
exit(EXIT_FAILURE);
}
/* destroy the scheduler */
sched_free(&sched);
exit(EXIT_FAILURE);
}
/* destroy the scheduler */
sched_free(&sched);
-
INFO1
("sem_sched terminated with exit code %d (success)", EXIT_SUCCESS);
+
XBT_INFO
("sem_sched terminated with exit code %d (success)", EXIT_SUCCESS);
return EXIT_SUCCESS;
return EXIT_SUCCESS;
@@
-159,24
+159,24
@@
void *ctx_function(void *param)
int exit_code = 1;
ctx_t ctx = (ctx_t) param;
int exit_code = 1;
ctx_t ctx = (ctx_t) param;
-
INFO1
("Hello i'm the owner of the context %d, i'm waiting for starting",
+
XBT_INFO
("Hello i'm the owner of the context %d, i'm waiting for starting",
ctx->index);
unschedule(ctx);
if (ctx->failure) {
ctx->index);
unschedule(ctx);
if (ctx->failure) {
-
INFO1
("0ups the scheduler initialization failed bye {%d}.",
+
XBT_INFO
("0ups the scheduler initialization failed bye {%d}.",
ctx->index);
xbt_os_thread_exit(&exit_code);
}
ctx->index);
xbt_os_thread_exit(&exit_code);
}
-
INFO1
("I'm the owner of the context %d : I'm started", ctx->index);
-
INFO0
("Wait a minute, I do my job");
+
XBT_INFO
("I'm the owner of the context %d : I'm started", ctx->index);
+
XBT_INFO
("Wait a minute, I do my job");
/* do its job */
exit_code = job_execute(ctx->job);
/* do its job */
exit_code = job_execute(ctx->job);
-
INFO1
("Have finished my job, bye {%d}\n", ctx->index);
+
XBT_INFO
("Have finished my job, bye {%d}\n", ctx->index);
xbt_os_sem_release(ctx->end);
xbt_os_sem_release(ctx->end);
@@
-348,13
+348,13
@@
int job(int argc, char **argv)
{
int i = 0;
{
int i = 0;
- INFO0
+ XBT_INFO
("I'm the job : I'm going to print all the args of my commande line");
("I'm the job : I'm going to print all the args of my commande line");
-
INFO1
("-- Arguments (%d):", argc);
+
XBT_INFO
("-- Arguments (%d):", argc);
for (i = 0; i < argc; i++)
for (i = 0; i < argc; i++)
-
INFO2
(" ---- [%i] %s", i, argv[i]);
+
XBT_INFO
(" ---- [%i] %s", i, argv[i]);
return 0;
}
return 0;
}
@@
-394,7
+394,7
@@
int job_execute(job_t job)
if (!job)
return EINVAL;
if (!job)
return EINVAL;
- return
(*(job->func))
(job->argc, job->argv);
+ return
job->func
(job->argc, job->argv);
}
int job_free(job_t * ref)
}
int job_free(job_t * ref)