mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sergey Vlasov <vsu@altlinux.ru>
To: "Luong Ngo" <luong.ngo@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Sleeping thread not receive signal until it wakes up
Date: Wed, 7 Mar 2007 21:09:03 +0300	[thread overview]
Message-ID: <20070307210903.0988be8f.vsu@altlinux.ru> (raw)
In-Reply-To: <1b2aacd80703062131g6c8578fgf200dd05a502c49f@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1380 bytes --]

On Tue, 6 Mar 2007 21:31:37 -0800 Luong Ngo wrote:

> I am having this problem. I have a process with 2 threads created. One
> of the thread will keep calling IOCTL  to get information from the
> kernel and will be blocked if there is no new information. If there is
> information retured, the thread will be checked to see if any error
> happens and trigger an action. Since we have no way to know if the
> error is gone (Hardware provides no signal), so what we do is when
> trigger an action for the error, we will set an timer using alarm()
> and register a SIGALRM handler in the thread by using sigaction. After
> setting the alarm, the thread will loop back and call IOCTL, which
> could cause it to be put to sleep. The problem is the SIGALRM handler
> does not receive the SIGALRM while the thread is being blocked by
> IOCTL. And if we generated some event so that the IOCTL is returned
> with new information, the SIGALRM handler is invoked right away.
> However, as I read the manual, which says a thread/process should be
> waken up even when it sleeps if there is a signal delivered to it. Am
> I right?

Probably the ioctl handler of the driver you are calling does not use
interruptible sleeps, therefore it cannot be interrupted by a signal.
In this case you need to fix the driver to use interruptible sleeps
and return -ERESTARTSYS when some signal is pending.

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

  parent reply	other threads:[~2007-03-07 18:33 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-07  5:31 Luong Ngo
2007-03-07 13:19 ` linux-os (Dick Johnson)
2007-03-07 19:28   ` Luong Ngo
2007-03-07 20:08     ` linux-os (Dick Johnson)
2007-03-07 21:03       ` Lee Revell
2007-03-08  0:40         ` Luong Ngo
2007-03-08  0:28       ` Luong Ngo
2007-03-08 13:01         ` linux-os (Dick Johnson)
2007-03-08 13:53           ` Thomas Gleixner
2007-03-08 22:52             ` Luong Ngo
2007-03-09 14:58               ` Sergey Vlasov
2007-03-09 19:50                 ` Luong Ngo
2007-03-07 20:20   ` Jan Engelhardt
2007-03-07 18:09 ` Sergey Vlasov [this message]
     [not found] <fa.kb3wuhac4W+1DqK61+sKe9uZwto@ifi.uio.no>
     [not found] ` <fa.cyXmbtXvYymKHdI0rEXZCxyk+KE@ifi.uio.no>
     [not found]   ` <fa.zPDT1vfJF5MjVXXQH/l+YSaLl84@ifi.uio.no>
     [not found]     ` <fa.HmQN7RhZNBRsiJYADMOsY8DL67k@ifi.uio.no>
     [not found]       ` <fa.PDmHwxZ3arhmED5SLuEONyxUlz4@ifi.uio.no>
     [not found]         ` <fa.ygLhZcCLgDxnwAYYVse/Xshr9IE@ifi.uio.no>
2007-03-09  1:10           ` Robert Hancock
2007-03-09  3:24             ` Luong Ngo
2007-03-09  3:45               ` Parav K Pandit
2007-03-10  0:10                 ` Luong Ngo
2007-03-10  8:22                   ` Sergey Vlasov
2007-03-10 10:54                     ` Luong Ngo

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=20070307210903.0988be8f.vsu@altlinux.ru \
    --to=vsu@altlinux.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luong.ngo@gmail.com \
    /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

Powered by JetHome