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
OpenThreads::cooperativeWait function (Unhandled exception at 0x75fdfbae in
helloworld.exe: Microsoft C++ exception: Win32ThreadCanceled at memory location
0x01edfd4b..). Here is my code:
#include <windows.h>
#include <iostream>
#include <process.h>
#include <OpenThreads/Thread>
class OpenThreadObject : public OpenThreads::Thread
{
public:
virtual void run()
{
for (int i = 0; i < 1000; ++i)
{
if (i > 100 && testCancel())
{
break;
}
std::cout << getThreadId() << ": " << i << std::endl;
}
}
};
void main()
{
OpenThreadObject* myThread = new OpenThreadObject;
myThread->start();
myThread->cancel();
myThread->join();
myThread->start();
myThread->join();
}
Are canceled threads allowed to be restarted?
Michael
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org