Changeset 1712f87 in mainline
- Timestamp:
- 2010-11-06T10:04:30Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0bbef9b, 3da12d74
- Parents:
- 0b81cad0 (diff), 9414abc (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/fibril_synch.c
r0b81cad0 r1712f87 180 180 void fibril_rwlock_read_lock(fibril_rwlock_t *frw) 181 181 { 182 fibril_t *f = (fibril_t *) fibril_get_id(); 183 182 184 futex_down(&async_futex); 183 185 if (frw->writers) { 184 fibril_t *f = (fibril_t *) fibril_get_id();185 186 awaiter_t wdata; 186 187 … … 195 196 fibril_switch(FIBRIL_TO_MANAGER); 196 197 } else { 197 frw->readers++; 198 /* Consider the first reader the owner. */ 199 if (frw->readers++ == 0) 200 frw->oi.owned_by = f; 198 201 futex_up(&async_futex); 199 202 } … … 229 232 assert(frw->readers || (frw->writers == 1)); 230 233 if (frw->readers) { 231 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 } 232 249 goto out; 250 } 233 251 } else { 234 252 frw->writers--; … … 265 283 list_remove(&wdp->wu_event.link); 266 284 fibril_add_ready(wdp->fid); 267 frw->readers++; 285 if (frw->readers++ == 0) { 286 /* Consider the first reader the owner. */ 287 frw->oi.owned_by = f; 288 } 268 289 optimize_execution_power(); 269 290 }
Note:
See TracChangeset
for help on using the changeset viewer.