[gccsdk] GCC4 crash with SDL threading
alex at alexwaugh.com
Mon Jul 7 14:48:05 PDT 2008
alan buckley <alan_baa at hotmail.com> wrote:
> The threading program had a different problem after that where
> the logic meant a pthread_yield was being called during a KILL signal
> handler. This reports:
> pthreads: *** fatal error aborting ***
> pthread_yield called with context switching disabled.
> Should this really be a fatal error?
In most cases yes, as it is indicative of a major failure. Some of the
pthreads code relies on pthread_yield guaranteeing to cause a context
> If it should, is there anyway I can test for context switching being
> disabled in C code so I can avoid the call to pthread_yield.
Normally, context switching cannot be disabled outside of
unixlib code. However signal handlers are a special case, mostly because
when you get a serious signal such as a segfault it is hard enough
already making sure the recovery is robust, without worrying about
threading problems as well.
The real solution is to improve the signal handlers to support context
switching, but in the absense of that, don't try to call pthread_yield
from a signal handler.
Alex Waugh alex at alexwaugh.com
PHP, Roots, Subversion, WebJames and more from http://www.alexwaugh.com/
More information about the gcc