the relevent ones (hashed queues may be shared) */
struct futex_q {
struct list_head list;
- struct task_struct *task;
+ wait_queue_head_t waiters;
/* Page struct and offset within it. */
struct page *page;
unsigned int offset;
return &futex_queues[hash_long(h, FUTEX_HASHBITS)];
}
+static inline void tell_waiter(struct futex_q *q)
+{
+ wake_up_all(&q->waiters);
+}
+
static int futex_wake(struct list_head *head,
struct page *page,
unsigned int offset,
if (this->page == page && this->offset == offset) {
list_del_init(i);
- wake_up_process(this->task);
+ tell_waiter(this);
num_woken++;
if (num_woken >= num) break;
}
/* Add at end to avoid starvation */
static inline void queue_me(struct list_head *head,
+ wait_queue_t *wait,
struct futex_q *q,
struct page *page,
unsigned int offset)
{
- q->task = current;
+ add_wait_queue(&q->waiters, wait);
q->page = page;
q->offset = offset;
{
int curval;
struct futex_q q;
+ DECLARE_WAITQUEUE(wait, current);
int ret = 0;
set_current_state(TASK_INTERRUPTIBLE);
- queue_me(head, &q, page, offset);
+ queue_me(head, &wait, &q, page, offset);
/* Page is pinned, but may no longer be in this address space. */
if (get_user(curval, uaddr) != 0) {