"Messages specific for this sem example");
#ifndef ENOBUFS
-#define ENOBUFS 1024
+#define ENOBUFS 1024
#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 **);
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);
}
sched = sched_new(size);
if (!sched) {
- INFO1("sched_new() failed : errno %d", errno);
+ XBT_INFO("sched_new() failed : errno %d", errno);
exit(EXIT_FAILURE);
}
/* 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);
- 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);
- INFO1("sched_init() failed : errno %d", errno);
+ XBT_INFO("sched_init() failed : errno %d", errno);
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;
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) {
- 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);
}
- 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);
- 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);
{
int i = 0;
- INFO0
+ XBT_INFO
("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++)
- INFO2(" ---- [%i] %s", i, argv[i]);
+ XBT_INFO(" ---- [%i] %s", i, argv[i]);
return 0;
}
if (!job)
return EINVAL;
- return (*(job->func)) (job->argc, job->argv);
+ return job->func(job->argc, job->argv);
}
int job_free(job_t * ref)