need advice about wait queue usage

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Can anybody on this list answer the following question:

My code contains a call to wait_event_interruptible_exclusive().
This results in the current task going to sleep on a wait queue.
It builds a wait_queue_t struct in its current stack frame,
setting the .func member to autoremove_wake_function(), adds it
to the wait queue, and finally reschedules.

At a later point in time, another thread calls wake_up_interruptible()
on the wait queue. This results in a call to autoremove_wake_function(),
which in turn calls default_wake_function(), which then calls
try_to_wake_up(). At this point, the previously sleeping task becomes
runnable again. Then, after default_wake_function() returns,
list_del_init() is called to remove the wait_queue_t from the
wait queue.

Now, since the wait_queue_t is allocated in the stack frame of the
just woken-up task, which could already be running at this point,
how can I be sure that the wait_queue_t is still valid at the point
list_del_init() is called to remove it from the wait queue? It
seems to me that I cannot and hence autoremove_wake_function() is
broken, or am I missing something?

Any responders pls. cc me; I am not subscribed to this list.

thanks,
Thomas
-- 
--------------------------------------------------

Thomas Koeller, Software Development
Basler Vision Technologies

thomas dot koeller at baslerweb dot com
http://www.baslerweb.com

==============================
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux