Subversion Repositories HelenOS-historic

Rev

Rev 1460 | Rev 1583 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1460 Rev 1502
Line 97... Line 97...
97
 
97
 
98
/** Sleep in futex wait queue.
98
/** Sleep in futex wait queue.
99
 *
99
 *
100
 * @param uaddr Userspace address of the futex counter.
100
 * @param uaddr Userspace address of the futex counter.
101
 * @param usec If non-zero, number of microseconds this thread is willing to sleep.
101
 * @param usec If non-zero, number of microseconds this thread is willing to sleep.
102
 * @param trydown If usec is zero and trydown is non-zero, conditional operation will be attempted.
102
 * @param flags Select mode of operation.
103
 *
103
 *
104
 * @return One of ESYNCH_TIMEOUT, ESYNCH_OK_ATOMIC and ESYNCH_OK_BLOCKED. See synch.h.
104
 * @return One of ESYNCH_TIMEOUT, ESYNCH_OK_ATOMIC and ESYNCH_OK_BLOCKED. See synch.h.
105
 *     If there is no physical mapping for uaddr ENOENT is returned.
105
 *     If there is no physical mapping for uaddr ENOENT is returned.
106
 */
106
 */
107
__native sys_futex_sleep_timeout(__address uaddr, __u32 usec, int trydown)
107
__native sys_futex_sleep_timeout(__address uaddr, __u32 usec, int flags)
108
{
108
{
109
    futex_t *futex;
109
    futex_t *futex;
110
    __address paddr;
110
    __address paddr;
111
    pte_t *t;
111
    pte_t *t;
112
    ipl_t ipl;
112
    ipl_t ipl;
Line 128... Line 128...
128
   
128
   
129
    interrupts_restore(ipl);   
129
    interrupts_restore(ipl);   
130
 
130
 
131
    futex = futex_find(paddr);
131
    futex = futex_find(paddr);
132
   
132
   
133
    return (__native) waitq_sleep_timeout(&futex->wq, usec, trydown);
133
    return (__native) waitq_sleep_timeout(&futex->wq, usec, flags | SYNCH_FLAGS_INTERRUPTIBLE);
134
}
134
}
135
 
135
 
136
/** Wakeup one thread waiting in futex wait queue.
136
/** Wakeup one thread waiting in futex wait queue.
137
 *
137
 *
138
 * @param uaddr Userspace address of the futex counter.
138
 * @param uaddr Userspace address of the futex counter.