Re: [osg-users] Restarting a canceled thread

2009-09-08 Thread Thibault Genessay
Hi folks I've tested the code (latest SVN) and get also get a crash when start() is called the scond time. Recreating the thread object indeed solves the problem, so it looks like there is actually something going wrong when a cancelled thread is restarted. Slightly OT w.r.t. Paul's remark, I

Re: [osg-users] Restarting a canceled thread

2009-09-08 Thread Ulrich Hertlein
Hi Michael, On 7/09/09 10:58 PM, Michael Guerrero wrote: ... void main() { OpenThreadObject* myThread = new OpenThreadObject; myThread-start(); myThread-cancel(); myThread-join(); myThread-start(); myThread-join(); } Are canceled threads allowed to be restarted? Can

Re: [osg-users] Restarting a canceled thread

2009-09-08 Thread Paul Martz
Thanks for the info on join(), but I guess I prefer the manual control feeling I get by waiting in my own loop. Good to know about join() though. Paul Martz Skew Matrix Software LLC _http://www.skew-matrix.com_ http://www.skew-matrix.com/ +1 303 859 9466 Thibault Genessay wrote: Hi folks

Re: [osg-users] Restarting a canceled thread

2009-09-08 Thread Michael Guerrero
So to clarify exactly where the exception is thrown here is the call stack: ot11-OpenThreadsd.dll!OpenThreads::cooperativeWait(void * waitHandle=0x00b0, unsigned long timeout=4294967295) Line 53 C++ ot11-OpenThreadsd.dll!OpenThreads::Win32ConditionPrivateData::broadcast() Line 73 +

[osg-users] Restarting a canceled thread

2009-09-07 Thread Michael Guerrero
Hi guys, I don't have that much experience writing threaded code so please forgive my ignorance. I've written a very simple test application using OpenThreads which runs a thread, stops it, and then tries to run it again. Seems straightforward but I get an unhandled exception from the

Re: [osg-users] Restarting a canceled thread

2009-09-07 Thread Paul Martz
Hi Michael -- I believe that after you cancel it, you should test to see if it has actually been canceled, something like this: myThread-start(); myThread-cancel(); while( !myThread-iSRunning() ) OpenThreads::Thread::microSleep( 100 ); myThread-start(); Also, I'm not sure what you are

Re: [osg-users] Restarting a canceled thread

2009-09-07 Thread Michael Guerrero
Thanks for the reply Paul. I was calling join because i wanted the main calling thread to block until myThread was finished. I know it doesn't make much sense to do it that way in this contrived example but in my actual application it would be nice to do this between scenario teardown and