lkml.org 
[lkml]   [1999]   [Jan]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Netscape broken with 2.2.0-pre7
Albert D. Cahalan wrote:
> Consider these events:
>
> 1. you check the buffer - it is empty
> 2. a signal arrives
> 3. you select() because you think the buffer is empty

> This race condition is documented as being unsolvable in the book
> "Advanced Programming in the Unix Environment" by Richard Stevens.
> Though it is getting obsolete, the book is still very good.
> (it does not cover Linux, BSD 4.4, or anything else recent)

Then I guess Stevens did not know about setjmp/longjmp, or the solution
I use is wrong:

1. you call sigsetjmp, and set a flag/store the jmpbuf address
2. you check the buffer - it is empty
3. a signal arrives - the handler sees the flag, clears it, calls siglongjmp
4. control continues from point 2
2b. you check the buffer - it is not empty

If select() returns, you clear the flag of course.

-- Jamie

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

\
 
 \ /
  Last update: 2005-03-22 13:49    [W:0.049 / U:0.820 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site