Changeset f6372be9 in mainline for uspace/lib/c/include/futex.h
- Timestamp:
- 2018-06-26T17:34:23Z (6 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- b59318e
- Parents:
- 38e3427
- git-author:
- Jiří Zárevúcky <jiri.zarevucky@…> (2018-06-25 20:50:53)
- git-committer:
- Jiří Zárevúcky <jiri.zarevucky@…> (2018-06-26 17:34:23)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/include/futex.h
r38e3427 rf6372be9 39 39 #include <errno.h> 40 40 #include <libc.h> 41 #include <time.h> 41 42 42 43 typedef struct futex { 43 44 atomic_t val; 45 #ifdef CONFIG_DEBUG_FUTEX 46 _Atomic void *owner; 47 #endif 44 48 } futex_t; 45 49 46 50 extern void futex_initialize(futex_t *futex, int value); 51 52 #ifdef CONFIG_DEBUG_FUTEX 53 54 #define FUTEX_INITIALIZE(val) {{ (val) }, NULL } 55 #define FUTEX_INITIALIZER FUTEX_INITIALIZE(1) 56 57 void __futex_assert_is_locked(futex_t *, const char *); 58 void __futex_assert_is_not_locked(futex_t *, const char *); 59 void __futex_lock(futex_t *, const char *); 60 void __futex_unlock(futex_t *, const char *); 61 bool __futex_trylock(futex_t *, const char *); 62 void __futex_give_to(futex_t *, void *, const char *); 63 64 #define futex_lock(futex) __futex_lock((futex), #futex) 65 #define futex_unlock(futex) __futex_unlock((futex), #futex) 66 #define futex_trylock(futex) __futex_trylock((futex), #futex) 67 68 #define futex_give_to(futex, new_owner) __futex_give_to((futex), (new_owner), #futex) 69 #define futex_assert_is_locked(futex) __futex_assert_is_locked((futex), #futex) 70 #define futex_assert_is_not_locked(futex) __futex_assert_is_not_locked((futex), #futex) 71 72 #else 47 73 48 74 #define FUTEX_INITIALIZE(val) {{ (val) }} … … 52 78 #define futex_trylock(fut) futex_trydown((fut)) 53 79 #define futex_unlock(fut) (void) futex_up((fut)) 80 81 #define futex_give_to(fut, owner) ((void)0) 82 #define futex_assert_is_locked(fut) assert((atomic_signed_t) (fut)->val.count <= 0) 83 #define futex_assert_is_not_locked(fut) ((void)0) 84 85 #endif 54 86 55 87 /** Try to down the futex.
Note:
See TracChangeset
for help on using the changeset viewer.