Re: Signal handling and system calls Lassi Kortela 12 May 2019 08:46 UTC
> Note that if you want otherwise, that is, you don't > want to restart the syscall, you can just throw your own exception > from the signal handler. If you throw an exception from the signal handler, which thread is that exception raised in? If we always run a Scheme signal handler in the main thread, or let Unix pick a thread at random, in either case it can be a different thread than the one that was running when we got the signal. > There are other cases as well: if read() is interrupted after some bytes > have been read, > you need to increment the buffer pointer and decrement the length. Don't read() and similar syscalls just return -1 bytes read and set errno to EINTR? I wasn't aware that they'd return partial data when interrupted by a signal.