signals and atomicity

1998-04-17 Thread erikyyy
hi, i found the following code in apache web server code. if the signal occurs after the wait system call, but before the result of the system call is stored in "wait_or_timeout_retval", the fact, that the system call succeeded is lost. this is (1) a bug in apache and (2) a problem of me that i w

Re: signals and atomicity

1998-04-17 Thread Rob Browning
[EMAIL PROTECTED] writes: > now perhaps it is not interesting, wether the wait call succeeded, because > you can start it again. but what about a call to "read()" ? i MUST know, > wether it worked or wether it was interrupted by a signal! Off the top of my head, if you issue a blocking read, and

Re: signals and atomicity

1998-04-18 Thread Herbert Xu
In article <[EMAIL PROTECTED]> you wrote: > if the signal occurs after the wait system call, but before the result of > the system call is stored in "wait_or_timeout_retval", the fact, that > the system call succeeded is lost. > this is (1) a bug in apache and (2) a problem of me that i want to s

Re: signals and atomicity

1998-04-19 Thread erikyyy
On Sat, 18 Apr 1998, Herbert Xu wrote: > In article <[EMAIL PROTECTED]> you wrote: > > > if the signal occurs after the wait system call, but before the result of > > the system call is stored in "wait_or_timeout_retval", the fact, that > > the system call succeeded is lost. > > > this is (1) a

Re: signals and atomicity

1998-04-19 Thread Rob Browning
[EMAIL PROTECTED] writes: > i think the whole system is shit. it cannot work this way. Nice temper. Not the best approach to getting help I've seen... > there is no single way to solve this problem with linux :-( i am very > unhappy. Apparently. > what is this good for ? well. threads commun

Re: signals and atomicity

1998-04-23 Thread Herbert Xu
In article <[EMAIL PROTECTED]> you wrote: > On Sat, 18 Apr 1998, Herbert Xu wrote: >> This should work: >> >> static int wait_or_timeout_retval = -1; >> >> static void alarm_handler(int sig) { >> errno = ETIMEDOUT; >> } >> >> int wait_or_timeout (int *status) { >> struct sigaction act

Re: signals and atomicity

1998-04-23 Thread erikyyy
On Thu, 23 Apr 1998, Herbert Xu wrote: > In article <[EMAIL PROTECTED]> you wrote: > > On Sat, 18 Apr 1998, Herbert Xu wrote: > >> This should work: > >> > >> static int wait_or_timeout_retval = -1; > >> > >> static void alarm_handler(int sig) { > >>errno = ETIMEDOUT; > >> } > >> > >> int

Re: signals and atomicity

1998-04-23 Thread Roman Hodek
> if you implement "interruptible" system calls this way: 1. UNBLOCK > SIGNAL 2. SYSTEM CALL 3. BLOCK SIGNAL it may happen that the signal > handler is called just after unblocking the signal but before the > call. this way no EINTR happens, the signal is lost and (2) is stuck > in the system call

Re: signals and atomicity

1998-04-23 Thread erikyyy
On Thu, 23 Apr 1998, Roman Hodek wrote: > > > if you implement "interruptible" system calls this way: 1. UNBLOCK > > SIGNAL 2. SYSTEM CALL 3. BLOCK SIGNAL it may happen that the signal > > handler is called just after unblocking the signal but before the > > call. this way no EINTR happens, the s