-
- }
-
- return 0;
-
-}
-
-int producer(int argc, char *argv[])
-{
-
- char * my_mailbox = bprintf("%s", argv[1]);
-
- while(1) {
-
- /* Create message */
- const char *mess = "message";
-
- pready = 1;
- XBT_INFO("pready = 1");
-
- /* CS request */
- XBT_INFO("Producer ask the request");
- MSG_task_send(MSG_task_create("request", 0, 1000, my_mailbox), "coordinator");
-
- /* Wait the answer */
- m_task_t grant = NULL;
- MSG_task_receive(&grant, my_mailbox);
- MSG_task_destroy(grant);
-
- /* Push message (size of buffer = 1) */
- buffer = strdup(mess);
-
- produce = 1;
- XBT_INFO("produce = 1");
-
- /* CS release */
- MSG_task_send(MSG_task_create("release", 0, 1000, my_mailbox), "coordinator");
-
- produce = 0;
- pready = 0;
-
- XBT_INFO("pready et produce = 0");
-