Changeset aaa3c457 in mainline for uspace/lib/c/generic/private
- Timestamp:
- 2018-11-12T10:36:10Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a43dfcb
- Parents:
- 3ce781f4 (diff), 6874bd2 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - git-author:
- Jakub Jermář <jakub@…> (2018-11-12 10:36:10)
- git-committer:
- GitHub <noreply@…> (2018-11-12 10:36:10)
- Location:
- uspace/lib/c/generic/private
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/private/async.h
r3ce781f4 raaa3c457 95 95 96 96 extern void __async_server_init(void); 97 extern void __async_server_fini(void); 97 98 extern void __async_client_init(void); 99 extern void __async_client_fini(void); 98 100 extern void __async_ports_init(void); 101 extern void __async_ports_fini(void); 99 102 100 103 extern errno_t async_create_port_internal(iface_t, async_port_handler_t, -
uspace/lib/c/generic/private/fibril.h
r3ce781f4 raaa3c457 79 79 80 80 extern void __fibrils_init(void); 81 extern void __fibrils_fini(void); 81 82 82 83 extern void fibril_wait_for(fibril_event_t *); … … 120 121 } fibril_rmutex_t; 121 122 122 #define FIBRIL_RMUTEX_INITIALIZER(name) \ 123 { .futex = FUTEX_INITIALIZE(1) } 124 125 #define FIBRIL_RMUTEX_INITIALIZE(name) \ 126 fibril_rmutex_t name = FIBRIL_RMUTEX_INITIALIZER(name) 127 128 extern void fibril_rmutex_initialize(fibril_rmutex_t *); 123 extern errno_t fibril_rmutex_initialize(fibril_rmutex_t *); 124 extern void fibril_rmutex_destroy(fibril_rmutex_t *); 129 125 extern void fibril_rmutex_lock(fibril_rmutex_t *); 130 126 extern bool fibril_rmutex_trylock(fibril_rmutex_t *); -
uspace/lib/c/generic/private/futex.h
r3ce781f4 raaa3c457 42 42 #include <time.h> 43 43 #include <fibril.h> 44 #include <abi/cap.h> 45 #include <abi/synch.h> 44 46 45 47 typedef struct futex { 46 48 volatile atomic_int val; 49 volatile cap_waitq_handle_t whandle; 50 47 51 #ifdef CONFIG_DEBUG_FUTEX 48 52 _Atomic(fibril_t *) owner; … … 50 54 } futex_t; 51 55 52 extern void futex_initialize(futex_t *futex, int value); 56 extern errno_t futex_initialize(futex_t *futex, int value); 57 58 static inline errno_t futex_destroy(futex_t *futex) 59 { 60 if (futex->whandle) { 61 errno_t rc; 62 rc = __SYSCALL1(SYS_WAITQ_DESTROY, (sysarg_t) futex->whandle); 63 futex->whandle = CAP_NIL; 64 return rc; 65 } 66 return EOK; 67 } 53 68 54 69 #ifdef CONFIG_DEBUG_FUTEX 55 56 #define FUTEX_INITIALIZE(val) { (val) , NULL }57 #define FUTEX_INITIALIZER FUTEX_INITIALIZE(1)58 70 59 71 void __futex_assert_is_locked(futex_t *, const char *); … … 74 86 #else 75 87 76 #define FUTEX_INITIALIZE(val) { (val) }77 #define FUTEX_INITIALIZER FUTEX_INITIALIZE(1)78 79 88 #define futex_lock(fut) (void) futex_down((fut)) 80 89 #define futex_trylock(fut) futex_trydown((fut)) … … 86 95 87 96 #endif 97 98 static inline errno_t futex_allocate_waitq(futex_t *futex) 99 { 100 return __SYSCALL1(SYS_WAITQ_CREATE, (sysarg_t) &futex->whandle); 101 } 88 102 89 103 /** Down the futex with timeout, composably. … … 107 121 { 108 122 // TODO: Add tests for this. 123 124 assert(futex->whandle != CAP_NIL); 109 125 110 126 if (atomic_fetch_sub_explicit(&futex->val, 1, memory_order_acquire) > 0) … … 132 148 } 133 149 134 return __SYSCALL2(SYS_FUTEX_SLEEP, (sysarg_t) futex, (sysarg_t) timeout); 150 return __SYSCALL3(SYS_WAITQ_SLEEP, (sysarg_t) futex->whandle, 151 (sysarg_t) timeout, (sysarg_t) SYNCH_FLAGS_FUTEX); 135 152 } 136 153 … … 147 164 { 148 165 if (atomic_fetch_add_explicit(&futex->val, 1, memory_order_release) < 0) 149 return __SYSCALL1(SYS_ FUTEX_WAKEUP, (sysarg_t) futex);166 return __SYSCALL1(SYS_WAITQ_WAKEUP, (sysarg_t) futex->whandle); 150 167 151 168 return EOK; -
uspace/lib/c/generic/private/malloc.h
r3ce781f4 raaa3c457 37 37 38 38 extern void __malloc_init(void); 39 extern void __malloc_fini(void); 39 40 40 41 #endif
Note:
See TracChangeset
for help on using the changeset viewer.
