I've been developing a multithreaded OpenCL/OpenGL application (see my website for more information).
I've got a problem in that the SDK registers a signal handler at some point, and responds to SIGINT with an exit(). This is very annoying as it doesn't give my threads a chance to clean themselves up as they don't exit cleanly. I'll have to use pthread cleanup handlers to fix this.
Does the SDK have to register a signal handler? Can someone explain why this behaviour is required and if it can be disabled?
I've done some more research and programming. My threads now respond to an exit() correctly and clean up, but I would still like to stop a SIGINT from calling exit().
If I run my code in gdb, and trigger a SIGINT, the signal handler jumps straight to libatiocl64.so
#0 0x00007fffe3636ef0 in ?? () from /usr/lib/libatiocl64.so
#1 <signal handler called>
....
So I ran strace to find when the signal handler is registered by the library, but I cannot find it. I tried setting a new signal handler periodically and it still won't use my signal handler. My handler works great however if I don't boot the OpenCL part of the code.
I'm guessing it's registered in some unusual manner?
I would like to register my own handler for SIGINT, any clues on how I can do this?
In SDK 2.3 it is true that LLVM installed a SIGINT handler. This has been changed for SDK 2.4, the system will no longer install a handler. You can install your own handlers in your application if you want to.
Hey, thanks for the reply!
It's good to know the signal handler will be removed. I tried periodically installing my own signal handler in my program but it seems to ignore my sigaction call. I guess if you've changed the SDK my problem will go away soon enough.
Thanks,
Marcus