Changeset d30e067 in mainline for uspace/lib/c/generic/thread/fibril_synch.c
- Timestamp:
- 2025-03-02T20:02:33Z (5 months ago)
- Children:
- 8cdf360
- Parents:
- 7debda3 (diff), 4285f384 (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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/thread/fibril_synch.c
r7debda3 rd30e067 1 1 /* 2 * Copyright (c) 2025 Jiri Svoboda 2 3 * Copyright (c) 2009 Jakub Jermar 3 4 * All rights reserved. … … 112 113 #define AWAITER_INIT { .fid = fibril_get_id() } 113 114 114 static void print_deadlock(fibril_owner_info_t *oi) 115 /** Print deadlock message nad blocking chain. 116 * 117 * @param oi Owner info for the resource being acquired 118 * @param f Fibril that is trying to acquire the resource 119 */ 120 static void print_deadlock(fibril_owner_info_t *oi, fibril_t *f) 115 121 { 116 122 // FIXME: Print to stderr. 117 118 fibril_t *f = (fibril_t *) fibril_get_id();119 123 120 124 if (deadlocked) { … … 143 147 } 144 148 145 static void check_fibril_for_deadlock(fibril_owner_info_t *oi, fibril_t *fib) 146 { 149 /** Check whether fibril trying to acquire a resource will cause deadlock. 150 * 151 * @param wanted_oi Owner info for the primitive that the fibril wants 152 * @param fib Fibril that wants to aquire the primitive 153 */ 154 static void check_fibril_for_deadlock(fibril_owner_info_t *wanted_oi, 155 fibril_t *fib) 156 { 157 fibril_owner_info_t *oi; 158 147 159 futex_assert_is_locked(&fibril_synch_futex); 148 160 161 oi = wanted_oi; 149 162 while (oi && oi->owned_by) { 150 163 if (oi->owned_by == fib) { 151 164 futex_unlock(&fibril_synch_futex); 152 print_deadlock( oi);165 print_deadlock(wanted_oi, fib); 153 166 abort(); 154 167 } … … 157 170 } 158 171 172 /** Check whether trying to acquire a resource will cause deadlock. 173 * 174 * @param oi Owner info for the primitive that the current fibril wants 175 */ 159 176 static void check_for_deadlock(fibril_owner_info_t *oi) 160 177 { … … 246 263 futex_lock(&fibril_synch_futex); 247 264 248 if (!frw->writers ) {265 if (!frw->writers && list_empty(&frw->waiters)) { 249 266 /* Consider the first reader the owner. */ 250 267 if (frw->readers++ == 0)
Note:
See TracChangeset
for help on using the changeset viewer.