Changes in / [32efd86:0578271] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/fibril_synch.c
r32efd86 r0578271 180 180 void fibril_rwlock_read_lock(fibril_rwlock_t *frw) 181 181 { 182 fibril_t *f = (fibril_t *) fibril_get_id();183 184 182 futex_down(&async_futex); 185 183 if (frw->writers) { 184 fibril_t *f = (fibril_t *) fibril_get_id(); 186 185 awaiter_t wdata; 187 186 … … 196 195 fibril_switch(FIBRIL_TO_MANAGER); 197 196 } else { 198 /* Consider the first reader the owner. */ 199 if (frw->readers++ == 0) 200 frw->oi.owned_by = f; 197 frw->readers++; 201 198 futex_up(&async_futex); 202 199 } … … 232 229 assert(frw->readers || (frw->writers == 1)); 233 230 if (frw->readers) { 234 if (--frw->readers) { 235 if (frw->oi.owned_by == (fibril_t *) fibril_get_id()) { 236 /* 237 * If this reader firbril was considered the 238 * owner of this rwlock, clear the ownership 239 * information even if there are still more 240 * readers. 241 * 242 * This is the limitation of the detection 243 * mechanism rooted in the fact that tracking 244 * all readers would require dynamically 245 * allocated memory for keeping linkage info. 246 */ 247 frw->oi.owned_by = NULL; 248 } 231 if (--frw->readers) 249 232 goto out; 250 }251 233 } else { 252 234 frw->writers--; … … 283 265 list_remove(&wdp->wu_event.link); 284 266 fibril_add_ready(wdp->fid); 285 if (frw->readers++ == 0) { 286 /* Consider the first reader the owner. */ 287 frw->oi.owned_by = f; 288 } 267 frw->readers++; 289 268 optimize_execution_power(); 290 269 }
Note:
See TracChangeset
for help on using the changeset viewer.