Messages in this thread | | | Date | Tue, 19 Jan 1999 17:21:26 +0000 | From | Jamie Lokier <> | Subject | Re: 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/
| |