On Thu, 25 Jan 2007, Robert Osfield wrote:
Hi Eric,
On 1/25/07, Eric Sokolowsky <[EMAIL PROTECTED]> wrote:
I was having many problems with crash-on-exit problems when I was using the
OpenThreads::Cancel facility. I found it a lot more stable to just set a
global variable and check that periodically within each thread and just
exit when it was set. Since I'm on Linux OpenThreads uses pthreads
underneath,
and I never got a satisfactory explanation on why pthread_cancel would
behave that way.
The problems I found were generally down to pthread_cancel only
cancelling when the thread gets to a pthread cancellation point, if
the code doesn't go through any of these then pthread_cancel will be
ignored. If other code then assume that the cancel has succeeded and
deletes associated objects the threads can end up reference deleted
memory.
The are several different types of pthread_cancel you can use. I
can't recall all the details off the top of my head, running through
man pthreads or online docs will help.
Robert.
Yes, I got very familiar with all of the types of pthread_cancel. I was
very careful about adding cancellation points. The problems I encountered
were not that the pthread_cancel calls were being ignored, but that the
application would crash when I tried to exit as a result of having threads
cancelled. If I just check a global variable within each thread (which
accomplishes much the same thing as adding an explicit cancellation point)
I didn't get any crashes. Probably down to a resource free order problem but
valgrind didn't help find anything and I didn't want to spend any more time
on it once I got a working solution.
--
____ __ Eric Sokolowsky (GST) NASA Goddard Space Flight Center
/ __/__/_/__ Visualization Programmer Scientific Visualization Studio
/ __/ _/ / _/ 301.286.3751 Mailstop 610.3 Bldg 28 Rm E102
/___/_//_/__/ [EMAIL PROTECTED] Greenbelt, MD 20771
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/