Changeset f787c8e in mainline for uspace/lib/c/include
- Timestamp:
- 2018-08-01T18:37:54Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 82d9087
- Parents:
- 1de92fb0
- Location:
- uspace/lib/c/include
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/include/fibril.h
r1de92fb0 rf787c8e 49 49 typedef fibril_t *fid_t; 50 50 51 typedef struct {52 fibril_t *fibril;53 } fibril_event_t;54 55 #define FIBRIL_EVENT_INIT ((fibril_event_t) {0})56 57 51 /** Fibril-local variable specifier */ 58 52 #define fibril_local __thread … … 82 76 extern __noreturn void fibril_exit(long); 83 77 84 extern void fibril_wait_for(fibril_event_t *);85 extern errno_t fibril_wait_timeout(fibril_event_t *, const struct timeval *);86 extern void fibril_notify(fibril_event_t *);87 88 extern errno_t fibril_ipc_wait(ipc_call_t *, const struct timeval *);89 extern void fibril_ipc_poke(void);90 91 78 #endif 92 79 -
uspace/lib/c/include/fibril_synch.h
r1de92fb0 rf787c8e 41 41 #include <sys/time.h> 42 42 #include <stdbool.h> 43 #include <futex.h>44 45 /**46 * "Restricted" fibril mutex.47 *48 * Similar to `fibril_mutex_t`, but has a set of restrictions placed on its49 * use. Within a rmutex critical section, you50 * - may not use any other synchronization primitive,51 * save for another `fibril_rmutex_t`. This includes nonblocking52 * operations like cvar signal and mutex unlock, unless otherwise53 * specified.54 * - may not read IPC messages55 * - may not start a new thread/fibril56 * (creating fibril without starting is fine)57 *58 * Additionally, locking with a timeout is not possible on this mutex,59 * and there is no associated condition variable type.60 * This is a design constraint, not a lack of implementation effort.61 */62 typedef struct {63 // TODO: At this point, this is just silly handwaving to hide current64 // futex use behind a fibril based abstraction. Later, the imple-65 // mentation will change, but the restrictions placed on this type66 // will allow it to be simpler and faster than a regular mutex.67 // There might also be optional debug checking of the assumptions.68 //69 // Note that a consequence of the restrictions is that if we are70 // running on a single thread, no other fibril can ever get to run71 // while a fibril has a rmutex locked. That means that for72 // single-threaded programs, we can reduce all rmutex locks and73 // unlocks to simple branches on a global bool variable.74 75 futex_t futex;76 } fibril_rmutex_t;77 78 #define FIBRIL_RMUTEX_INITIALIZER(name) \79 { .futex = FUTEX_INITIALIZE(1) }80 81 #define FIBRIL_RMUTEX_INITIALIZE(name) \82 fibril_rmutex_t name = FIBRIL_RMUTEX_INITIALIZER(name)83 43 84 44 typedef struct { … … 204 164 fibril_semaphore_t name = FIBRIL_SEMAPHORE_INITIALIZER(name, cnt) 205 165 206 extern void fibril_rmutex_initialize(fibril_rmutex_t *);207 extern void fibril_rmutex_lock(fibril_rmutex_t *);208 extern bool fibril_rmutex_trylock(fibril_rmutex_t *);209 extern void fibril_rmutex_unlock(fibril_rmutex_t *);210 211 166 extern void fibril_mutex_initialize(fibril_mutex_t *); 212 167 extern void fibril_mutex_lock(fibril_mutex_t *); -
uspace/lib/c/include/ipc/common.h
r1de92fb0 rf787c8e 37 37 38 38 #include <abi/ipc/ipc.h> 39 #include <atomic.h>40 39 #include <abi/proc/task.h> 41 #include <futex.h>42 40 #include <abi/cap.h> 41 #include <types/common.h> 43 42 44 43 #define IPC_FLAG_BLOCKING 0x01
Note:
See TracChangeset
for help on using the changeset viewer.