Re: wake_up from interrupt handler

Arjan van de Ven (arjanv@redhat.com)
07 Oct 2002 15:04:17 +0200


--=-Lt3Md7du0AWNfD4+pde3
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

On Mon, 2002-10-07 at 14:41, Amol Lad wrote:
> Hi,
> I have a kernel thread which did add_to_wait_queue()
> to wait for an event.=20
> The event for which above thread is waiting occurs in
> an interrupt handler that calls wake_up() to wake the
> above thread.=20
> Now I am faced with a 'lost wakeup' problem, in which
> the =20
> kernel thread checks whether event occured, he finds
> it to be 'not-occured' but before calling
> add_to_wait_queue(), interrupt handler detects that
> the event has occured and calls wake_up().
> My thread sleeps forever.

set_current_state(TASK_INTERRUPTIBLE);
add_to_wait_queue(...);
if (even_occured) { ...}=20
else
schedule();
=20
remove_from_wait_queue(..);
set_current_state(TASK_RUNNABLE);

>=20

--=-Lt3Md7du0AWNfD4+pde3
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQA9oYZRxULwo51rQBIRAqdlAJ9k8yOdTx+fjqQqQosdgdWoGDG5DACffrbP
Gzwmt6Eh4rEjrdiwQ1sIfP4=
=Y02o
-----END PGP SIGNATURE-----

--=-Lt3Md7du0AWNfD4+pde3--

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