1 /* Copyright (c) 2019-2021. The SimGrid Team. All rights reserved. */
3 /* This program is free software; you can redistribute it and/or modify it
4 * under the terms of the license (GNU LGPL) which comes with this package. */
6 #ifndef INCLUDE_SIMGRID_COND_H_
7 #define INCLUDE_SIMGRID_COND_H_
9 #include <simgrid/forward.h>
13 /** @brief Creates a condition variable */
14 XBT_PUBLIC sg_cond_t sg_cond_init();
16 /** @brief Blocks onto the given condition variable */
17 XBT_PUBLIC void sg_cond_wait(sg_cond_t cond, sg_mutex_t mutex);
18 /** @brief Blocks onto the given condition variable, but only for the given amount of time.
19 * @return 0 on success, 1 on timeout */
20 XBT_PUBLIC int sg_cond_wait_for(sg_cond_t cond, sg_mutex_t mutex, double delay);
21 /** @brief Signals the given condition variable */
22 XBT_PUBLIC void sg_cond_notify_one(sg_cond_t cond);
23 /** @brief Broadcasts the given condition variable */
24 XBT_PUBLIC void sg_cond_notify_all(sg_cond_t cond);
25 /** @brief Destroys the given condition variable */
26 XBT_PUBLIC void sg_cond_destroy(const_sg_cond_t cond);
30 #endif /* INCLUDE_SIMGRID_COND_H_ */