X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/edca9509f1ec94a851e0265c1876a4733f4fff87..fbf5fafb60eb44c0c00a7283fd05a6dec5f2b58f:/src/msg/msg_legacy.cpp diff --git a/src/msg/msg_legacy.cpp b/src/msg/msg_legacy.cpp index 297c8f4308..fd4562c206 100644 --- a/src/msg/msg_legacy.cpp +++ b/src/msg/msg_legacy.cpp @@ -1,8 +1,9 @@ -/* Copyright (c) 2004-2018. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2004-2019. The SimGrid Team. All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ +#include "simgrid/Exception.hpp" #include "src/msg/msg_private.hpp" #define MSG_CALL(type, oldname, args) @@ -124,6 +125,26 @@ void MSG_process_yield() sg_actor_yield(); } +msg_error_t MSG_process_sleep(double duration) +{ + try { + sg_actor_sleep_for(duration); + return MSG_OK; + } catch (simgrid::HostFailureException& e) { + return MSG_HOST_FAILURE; + } +} + +msg_process_t MSG_process_attach(const char* name, void* data, msg_host_t host, xbt_dict_t properties) +{ + return sg_actor_attach(name, data, host, properties); +} + +void MSG_process_detach() +{ + sg_actor_detach(); +} + /* ************************** NetZones *************************** */ sg_netzone_t MSG_zone_get_root() { @@ -273,9 +294,9 @@ int MSG_host_is_on(sg_host_t h) { return sg_host_is_on(h); } -int MSG_host_is_off(sg_host_t h) +int MSG_host_is_off(sg_host_t h) // deprecated { - return sg_host_is_off(h); + return not sg_host_is_on(h); } xbt_dict_t MSG_host_get_properties(sg_host_t host) { @@ -297,6 +318,11 @@ sg_host_t MSG_host_self() { return sg_host_self(); } + +double MSG_host_get_load(sg_host_t host) +{ + return sg_host_load(host); +} /* ************************** Virtual Machines *************************** */ sg_vm_t MSG_vm_create_core(sg_host_t pm, const char* name) { @@ -373,3 +399,32 @@ int MSG_barrier_wait(sg_bar_t bar) { return sg_barrier_wait(bar); } + +sg_sem_t MSG_sem_init(int initial_value) +{ + return sg_sem_init(initial_value); +} +void MSG_sem_acquire(sg_sem_t sem) +{ + sg_sem_acquire(sem); +} +int MSG_sem_acquire_timeout(sg_sem_t sem, double timeout) +{ + return sg_sem_acquire_timeout(sem, timeout); +} +void MSG_sem_release(sg_sem_t sem) +{ + sg_sem_release(sem); +} +int MSG_sem_get_capacity(sg_sem_t sem) +{ + return sg_sem_get_capacity(sem); +} +void MSG_sem_destroy(sg_sem_t sem) +{ + sg_sem_destroy(sem); +} +int MSG_sem_would_block(sg_sem_t sem) +{ + return sg_sem_would_block(sem); +}