Am 21.11.2005 um 02:28 schrieb Brad Fuller:
Bert Freudenberg wrote:
Did you wrap the usleep() into a while loop checking for EINTR?
googling, I found many instances of usleep to be a problem in multithreading. One place said usleep sets an alarm signal to wait. When it occurs, usleep returns. SIGALRM should not be blocked and if it is, usleep will exit. This was my problem.
I abandoned usleep and instead tried nanosleep. The result was the same - I heard just a blip. So, I wrapped the call to nanosleep with blocking the signals with pthread_sigmask(), called nanosleep and then unblocked the signals. This worked.
But, I don't know why. I still don't understand how this would effect the call to the library from Squeak and not as a standalone. What is different, or added, with Squeak that is not with the standalone test?
Squeak uses SIGALARM itself, unless you run the VM with -notimer. Which you should not do unless you do not care about performance.
- Bert -