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

Ingo Weinhold wrote:
> 
> On 2008-10-30 at 10:47:20 [+0100], Stephan Assmus <superstippi@xxxxxx> 
> wrote:
> > Ok, am I summing up correctly that I do want to use B_CAN_INTERRUPT, 
> > but then if I get B_INTERRUPTED as the return code from 
> > acquire_sem_etc() -> treat that as error and bail out.
> 
> Yep. And probably notify whoever would release the semaphore, that things 
> have changed (which I referred to as "cleanup").

Ok, I think it wouldn't be a problem in this particular case.

> > In another words, I wouldn't get
> > interrupted unintentionally by "something unrelated", would I?
> 
> 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? How 
would I check the reason for B_INTERRUPTED in the thread that calls ioctl()?

Best regards,
-Stephan

Other related posts: