Changes in kernel/generic/src/synch/waitq.c [3954961e:9d58539] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/synch/waitq.c
r3954961e r9d58539 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 wakeups449 * at the time.450 *451 * Example usage:452 * @code453 * 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 accessing467 * // wq in waitq_wakeup(). Therefore it is not yet safe to return468 * // 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 * @endcode473 *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 482 444 483 445 /** Internal SMP- and IRQ-unsafe version of waitq_wakeup()
Note:
See TracChangeset
for help on using the changeset viewer.