6 XBT_LOG_NEW_DEFAULT_CATEGORY(msg_semaphore_example,
7 "Messages specific for this msg example");
11 int peer(int argc, char* argv[]){
16 double wait_time = atof(argv[i++]);
17 MSG_process_sleep(wait_time);
18 XBT_INFO("Trying to acquire");
22 wait_time = atof(argv[i++]);
23 MSG_process_sleep(wait_time);
24 XBT_INFO("Releasing");
31 int main(int argc, char* argv[]) {
33 MSG_init(&argc, argv);
34 MSG_create_environment(argv[1]);
36 xbt_dynar_t hosts = MSG_hosts_as_dynar();
37 msg_host_t h = xbt_dynar_get_as(hosts,0,msg_host_t);
40 char* aliceTimes[] = {"0", "1", "3", "5", "1", "2", "5", "0"};
41 char* bobTimes[] = {"1", "1", "1", "2", "2", "0", "0", "5"};
44 MSG_process_create_with_arguments("Alice", peer, NULL,
46 MSG_process_create_with_arguments("Bob", peer, NULL,