Changes in kernel/generic/src/synch/waitq.c [9d58539:3954961e] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/synch/waitq.c
r9d58539 r3954961e 442 442 irq_spinlock_unlock(&wq->lock, true); 443 443 } 444 445 /** If there is a wakeup in progress actively waits for it to complete. 446 * 447 * The function returns once the concurrently running waitq_wakeup() 448 * exits. It returns immediately if there are no concurrent wakeups 449 * at the time. 450 * 451 * Example usage: 452 * @code 453 * void callback(waitq *wq) 454 * { 455 * // Do something and notify wait_for_completion() that we're done. 456 * waitq_wakeup(wq); 457 * } 458 * void wait_for_completion(void) 459 * { 460 * waitq wg; 461 * waitq_initialize(&wq); 462 * // Run callback() in the background, pass it wq. 463 * do_asynchronously(callback, &wq); 464 * // Wait for callback() to complete its work. 465 * waitq_sleep(&wq); 466 * // callback() completed its work, but it may still be accessing 467 * // wq in waitq_wakeup(). Therefore it is not yet safe to return 468 * // or it would clobber up our stack (where wq is stored). 469 * waitq_complete_wakeup(&wq); 470 * // waitq_wakeup() is complete, it is safe to free wq. 471 * } 472 * @endcode 473 * 474 * @param wq Pointer to a wait queue. 475 */ 476 void waitq_complete_wakeup(waitq_t *wq) 477 { 478 irq_spinlock_lock(&wq->lock, true); 479 irq_spinlock_unlock(&wq->lock, true); 480 } 481 444 482 445 483 /** Internal SMP- and IRQ-unsafe version of waitq_wakeup()
Note:
See TracChangeset
for help on using the changeset viewer.