The Scenario: You're porting your multithreaded software that works great on all kernel versions of Linux, FreeBSD, etc., but when you try to run on Solaris, at a repeatable point in the program, the process just exits with the error message "aborted". Even when you step through the code in gdb, the program exits unexpectedly. You might see something about a SIGALARM.
What's going on: Solaris, unfortunately, uses SIGALARM for both (a) coordinating among multiple threads in a multithreaded application and (b) the usleep() function in libc. So, if you ever call usleep() in a multithreaded app on Solaris (on 2.8 at least), then when the call returns, your program will abend as described above. Since it's going to be a lot harder getting rid of the multithreaded-ness of your application, I'd recommend that you just don't use usleep(). Or maybe conditionally define it away on Solaris.
Comments