Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Update copyright lines for 2022.
[simgrid.git] / include / simgrid / cond.h
1 /* Copyright (c) 2019-2022. The SimGrid Team. All rights reserved.          */
2
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. */
5
6 #ifndef INCLUDE_SIMGRID_COND_H_
7 #define INCLUDE_SIMGRID_COND_H_
8
9 #include <simgrid/forward.h>
10
11 /* C interface */
12 SG_BEGIN_DECL
13 /** @brief Creates a condition variable */
14 XBT_PUBLIC sg_cond_t sg_cond_init();
15
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);
27
28 SG_END_DECL
29
30 #endif /* INCLUDE_SIMGRID_COND_H_ */