Changeset b59318e in mainline for kernel/generic/src/synch/futex.c


Ignore:
Timestamp:
2018-06-26T17:34:48Z (6 years ago)
Author:
Jiří Zárevúcky <jiri.zarevucky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
ab6edb6
Parents:
f6372be9
git-author:
Jiří Zárevúcky <jiri.zarevucky@…> (2018-06-26 17:01:43)
git-committer:
Jiří Zárevúcky <jiri.zarevucky@…> (2018-06-26 17:34:48)
Message:

Make futex able to time out.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/synch/futex.c

    rf6372be9 rb59318e  
    398398}
    399399
    400 /** Sleep in futex wait queue.
    401  *
    402  * @param uaddr         Userspace address of the futex counter.
     400/** Sleep in futex wait queue with a timeout.
     401 *  If the sleep times out or is interrupted, the next wakeup is ignored.
     402 *  The userspace portion of the call must handle this condition.
     403 *
     404 * @param uaddr         Userspace address of the futex counter.
     405 * @param timeout       Maximum number of useconds to sleep. 0 means no limit.
    403406 *
    404407 * @return              If there is no physical mapping for uaddr ENOENT is
     
    406409 *                      waitq_sleep_timeout().
    407410 */
    408 sys_errno_t sys_futex_sleep(uintptr_t uaddr)
     411sys_errno_t sys_futex_sleep(uintptr_t uaddr, uintptr_t timeout)
    409412{
    410413        futex_t *futex = get_futex(uaddr);
     
    417420#endif
    418421
    419         errno_t rc = waitq_sleep_timeout(
    420             &futex->wq, 0, SYNCH_FLAGS_INTERRUPTIBLE, NULL);
     422        errno_t rc = waitq_sleep_timeout(&futex->wq, timeout,
     423            SYNCH_FLAGS_INTERRUPTIBLE | SYNCH_FLAGS_FUTEX, NULL);
    421424
    422425#ifdef CONFIG_UDEBUG
Note: See TracChangeset for help on using the changeset viewer.