> On Mon, 7 Jul 2008 22:48:05 +0100 Alex Waugh wrote: > > alan buckley 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 > switch.
Thanks for the explanation of why it must be this way. > >> 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. > OK. The problem was in imported code using a library function. I was hoping there was some function I could call in unixlib to check it was OK to call pthread_yield. I'll have to look for another solution. Thanks for the reply, Alan _________________________________________________________________ The John Lewis Clearance - save up to 50% with FREE delivery http://clk.atdmt.com/UKM/go/101719806/direct/01/ _______________________________________________ GCCSDK mailing list [email protected] Bugzilla: http://www.riscos.info/bugzilla/index.cgi List Info: http://www.riscos.info/mailman/listinfo/gcc Main Page: http://www.riscos.info/index.php/GCCSDK
