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

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

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").

> 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.

CU, Ingo

Other related posts: