public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Roland Dreier <roland@topspin.com>
To: Hendrik Wiese <7.e.Q@syncro-community.de>
Cc: LKLM <linux-kernel@vger.kernel.org>
Subject: Re: wait_event_interruptible
Date: Tue, 07 Dec 2004 05:32:58 -0800	[thread overview]
Message-ID: <52is7ecjxx.fsf@topspin.com> (raw)
In-Reply-To: <41B56798.4070505@syncro-community.de> (Hendrik Wiese's message of "Tue, 07 Dec 2004 09:19:36 +0100")

    Hendrik> Hello, I created a kernel thread inside of my driver by
    Hendrik> calling the function kernel_thread with a function
    Hendrik> pointer. Now this thread calls daemonize and allow_signal
    Hendrik> and then it runs a forever loop until it is terminated by
    Hendrik> the kernel (unloading the driver etc). And because it is
    Hendrik> written in the documentation I put the thread asleep by
    Hendrik> calling wait_event_interruptible with a wait queue called
    Hendrik> "dpn_wq_run" inside the forever loop. Now is it right
    Hendrik> that a wake_up_interruptible in the ISR has to wake up
    Hendrik> the thread so it continues its work? If yes... why isn't
    Hendrik> that working for me? I called wait_event_interruptible
    Hendrik> with that dpn_wq_run inside the kernel thread and do a
    Hendrik> wake_up_interruptible inside the ISR with the same
    Hendrik> dpn_wq_run. But my kernel thread won't wake up. Is there
    Hendrik> anything else I have to do to the wait queue, but calling
    Hendrik> init_wait_queue on it?

wait_event_interruptible() will sleep until your ISR wakes it up, but
for your thread to run, you also need to make sure that the condition
being tested by wait_event_interruptible() is true (otherwise it will
go back to sleep).  For example, if your thread does:

	wait_event_interruptible(&my_wait, work != 0);

then your ISR needs to do

	work = 1;
	wake_up_interruptible(&my_wait);

If you don't set work, the wake_up will have no effect.

 - R.

  reply	other threads:[~2004-12-07 13:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-07  8:19 wait_event_interruptible Hendrik Wiese
2004-12-07 13:32 ` Roland Dreier [this message]
2004-12-07 13:56   ` wait_event_interruptible Hendrik Wiese

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=52is7ecjxx.fsf@topspin.com \
    --to=roland@topspin.com \
    --cc=7.e.Q@syncro-community.de \
    --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