From: Thomas Koeller <thomas.koeller@baslerweb.com>
To: linux-kernel@vger.kernel.org
Subject: need advice about wait queue usage
Date: Thu, 14 Apr 2005 11:49:19 +0200 [thread overview]
Message-ID: <200504141149.20001.thomas.koeller@baslerweb.com> (raw)
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
==============================
reply other threads:[~2005-04-14 9:49 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200504141149.20001.thomas.koeller@baslerweb.com \
--to=thomas.koeller@baslerweb.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox