[haiku-development] Re: correct way to acquire_sem_etc()

  • From: Ingo Weinhold <ingo_weinhold@xxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Thu, 30 Oct 2008 14:37:26 +0100

On 2008-10-30 at 14:10:00 [+0100], Stephan Assmus <superstippi@xxxxxx> wrote:
> Ingo Weinhold wrote:
> > That depends on how related you consider signals to the thread. E.g. if
> > the thread doesn't ignore SIGWINCH resizing the Terminal window will
> > interrupt it. The ioctl() caller should be aware of that though and deal
> > with it correctly when it gets back B_INTERRUPTED.
> 
> When the input_server is started from the command line, will only the main
> thread receive this signal, or would child threads receive it as well?

Only the main thread gets signals from the terminal (and only when running in 
the foreground).

> How
> would I check the reason for B_INTERRUPTED in the thread that calls ioctl()?

If you mean the ioctl() caller, you can't. The only way is to install signal 
handlers for all relevant signals and in the signal handlers set a flag to 
indicate that the signal occurred. I don't think that will be necessary in 
the input server though. If the signal is not deadly, I would simply repeat 
the ioctl() call, if that's an option. If not, just pass the error on.

CU, Ingo

Other related posts: