Changeset 156b6406 in mainline for uspace/lib/urcu/rcu.c
- Timestamp:
- 2012-12-04T16:42:06Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- b188002
- Parents:
- b7acf38
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/urcu/rcu.c
rb7acf38 r156b6406 168 168 assert(!fibril_rcu.registered); 169 169 170 _futex_down(&rcu.list_futex);170 futex_down(&rcu.list_futex); 171 171 list_append(&fibril_rcu.link, &rcu.fibrils_list); 172 _futex_up(&rcu.list_futex);172 futex_up(&rcu.list_futex); 173 173 174 174 fibril_rcu.registered = true; … … 193 193 fibril_rcu.nesting_cnt = 0; 194 194 195 _futex_down(&rcu.list_futex);195 futex_down(&rcu.list_futex); 196 196 list_remove(&fibril_rcu.link); 197 _futex_up(&rcu.list_futex);197 futex_up(&rcu.list_futex); 198 198 199 199 fibril_rcu.registered = false; … … 330 330 static void wait_for_readers(size_t reader_group, blocking_mode_t blocking_mode) 331 331 { 332 _futex_down(&rcu.list_futex);332 futex_down(&rcu.list_futex); 333 333 334 334 list_t quiescent_fibrils; … … 341 341 342 342 if (is_preexisting_reader(fib, reader_group)) { 343 _futex_up(&rcu.list_futex);343 futex_up(&rcu.list_futex); 344 344 sync_sleep(blocking_mode); 345 _futex_down(&rcu.list_futex);345 futex_down(&rcu.list_futex); 346 346 /* Break to while loop. */ 347 347 break; … … 354 354 355 355 list_concat(&rcu.fibrils_list, &quiescent_fibrils); 356 _futex_up(&rcu.list_futex);356 futex_up(&rcu.list_futex); 357 357 } 358 358 359 359 static void lock_sync(blocking_mode_t blocking_mode) 360 360 { 361 _futex_down(&rcu.sync_lock.futex);361 futex_down(&rcu.sync_lock.futex); 362 362 if (rcu.sync_lock.locked) { 363 363 if (blocking_mode == BM_BLOCK_FIBRIL) { … … 369 369 do { 370 370 blocked_fib.is_ready = false; 371 _futex_up(&rcu.sync_lock.futex);371 futex_up(&rcu.sync_lock.futex); 372 372 fibril_switch(FIBRIL_TO_MANAGER); 373 _futex_down(&rcu.sync_lock.futex);373 futex_down(&rcu.sync_lock.futex); 374 374 } while (rcu.sync_lock.locked); 375 375 … … 379 379 assert(blocking_mode == BM_BLOCK_THREAD); 380 380 rcu.sync_lock.blocked_thread_cnt++; 381 _futex_up(&rcu.sync_lock.futex);382 _futex_down(&rcu.sync_lock.futex_blocking_threads);381 futex_up(&rcu.sync_lock.futex); 382 futex_down(&rcu.sync_lock.futex_blocking_threads); 383 383 } 384 384 } else { … … 397 397 if (0 < rcu.sync_lock.blocked_thread_cnt) { 398 398 --rcu.sync_lock.blocked_thread_cnt; 399 _futex_up(&rcu.sync_lock.futex_blocking_threads);399 futex_up(&rcu.sync_lock.futex_blocking_threads); 400 400 } else { 401 401 /* Unlock but wake up any fibrils waiting for the lock. */ … … 412 412 413 413 rcu.sync_lock.locked = false; 414 _futex_up(&rcu.sync_lock.futex);414 futex_up(&rcu.sync_lock.futex); 415 415 } 416 416 } … … 423 423 * but keep sync locked. 424 424 */ 425 _futex_up(&rcu.sync_lock.futex);425 futex_up(&rcu.sync_lock.futex); 426 426 427 427 if (blocking_mode == BM_BLOCK_FIBRIL) { … … 431 431 } 432 432 433 _futex_down(&rcu.sync_lock.futex);433 futex_down(&rcu.sync_lock.futex); 434 434 } 435 435
Note:
See TracChangeset
for help on using the changeset viewer.