/* 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 <xbt/ex.hpp>
+
#include "msg_private.h"
#include "xbt/sysdep.h"
#include "xbt/synchro_core.h"
/** @brief locks on a semaphore object up until the provided timeout expires */
msg_error_t MSG_sem_acquire_timeout(msg_sem_t sem, double timeout) {
- xbt_ex_t e;
msg_error_t res = MSG_OK;
- TRY {
+ try {
simcall_sem_acquire_timeout(sem,timeout);
- } CATCH(e) {
- if (e.category == timeout_error) {
- res = MSG_TIMEOUT;
- xbt_ex_free(e);
- } else {
- RETHROW;
- }
+ } catch(xbt_ex& e) {
+ if (e.category == timeout_error)
+ return MSG_TIMEOUT;
+ throw;
}
return res;
}