Changeset 1b20da0 in mainline for kernel/generic/src/synch/waitq.c
- Timestamp:
- 2018-02-28T17:52:03Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 3061bc1
- Parents:
- df6ded8
- git-author:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-02-28 17:26:03)
- git-committer:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-02-28 17:52:03)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/synch/waitq.c
rdf6ded8 r1b20da0 341 341 * Wait for a waitq_wakeup() or waitq_unsleep() to complete 342 342 * before returning from waitq_sleep() to the caller. Otherwise 343 * the caller might expect that the wait queue is no longer used 344 * and deallocate it (although the wakeup on a another cpu has 343 * the caller might expect that the wait queue is no longer used 344 * and deallocate it (although the wakeup on a another cpu has 345 345 * not yet completed and is using the wait queue). 346 346 * … … 474 474 475 475 /** If there is a wakeup in progress actively waits for it to complete. 476 * 476 * 477 477 * The function returns once the concurrently running waitq_wakeup() 478 * exits. It returns immediately if there are no concurrent wakeups 478 * exits. It returns immediately if there are no concurrent wakeups 479 479 * at the time. 480 * 480 * 481 481 * Interrupts must be disabled. 482 * 482 * 483 483 * Example usage: 484 484 * @code … … 488 488 * waitq_wakeup(wq); 489 489 * } 490 * void wait_for_completion(void) 490 * void wait_for_completion(void) 491 491 * { 492 492 * waitq wg; … … 496 496 * // Wait for callback() to complete its work. 497 497 * waitq_sleep(&wq); 498 * // callback() completed its work, but it may still be accessing 499 * // wq in waitq_wakeup(). Therefore it is not yet safe to return 500 * // from waitq_sleep() or it would clobber up our stack (where wq 498 * // callback() completed its work, but it may still be accessing 499 * // wq in waitq_wakeup(). Therefore it is not yet safe to return 500 * // from waitq_sleep() or it would clobber up our stack (where wq 501 501 * // is stored). waitq_sleep() ensures the wait queue is no longer 502 502 * // in use by invoking waitq_complete_wakeup() internally. 503 * 503 * 504 504 * // waitq_sleep() returned, it is safe to free wq. 505 505 * } 506 506 * @endcode 507 * 507 * 508 508 * @param wq Pointer to a wait queue. 509 509 */
Note:
See TracChangeset
for help on using the changeset viewer.