XROAD
xroad_rwlock.h
Go to the documentation of this file.
1 #pragma once
7 #include <stdint.h>
8 
9 typedef struct xroad_rwlock_s xroad_rwlock_t;
10 
11 /*
12  * @brief agressively acuires write lock
13  * @param[in] l - rwlock
14  */
15 void xroad_rwlock_lock(xroad_rwlock_t* l);
16 
17 /*
18  * @brief releases write lock
19  * @param[in] l - rwlock
20  */
21 void xroad_rwlock_unlock(xroad_rwlock_t* l);
22 
23 /*
24  * @brief tries to aquire read lock
25  * @param[in] l - rwlock
26  * @return true if success
27  */
28 int32_t xroad_rwlock_try_shared_lock(xroad_rwlock_t* l);
29 
30 /*
31  * @brief aquires read lock, waits if there is writer
32  * @param[in] l - rwlock
33  */
34 void xroad_rwlock_shared_lock(xroad_rwlock_t* l);
35 
36 /*
37  * @brief releases read lock
38  * @param[in] l - rwlock
39  */
40 void xroad_rwlock_shared_unlock(xroad_rwlock_t* l);
41 
42 /*
43  *
44  *
45  */
46 int32_t xroad_rwlock_number_wlock(xroad_rwlock_t* l);
47 
48 int32_t xroad_rwlock_number_rlock(xroad_rwlock_t* l);