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 you verify if the exception is thrown from the second 'start()' call?

Not that I'm too familiar with the Win32 API but I've experienced this before and I believe there is a bug in the win32 implementation.

'cancel()' sets cancelEvent. This is checked in 'testCancel()' but also in cooperativeWait(), which is where the exception is apparently thrown.

I believe the cancelEvent should be reset on each 'start()', otherwise it will still be in the flagged cancelled state.

You could try to put a 'ResetEvent(pd->cancelEvent.get());' in Win32Thread.cpp: Thread::start() before the call to '_beginthreadex'.

Cheers,
/ulrich
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to