I'm having a problem with an existing application that runs well on a 32-bit windows XP (VS 2003) system, but does not seem to work when ran on a 64-bit windows XP (VS 2003) system.
I narrowed down the problem to Openthreads, seems that my threaded while loop never (or rarely) gets called. I was able to recreate the problem with this simple program below. It runs two threads, both printing a message to the screen. Only one message is displayed on a 64bit machine. I turned on OSG notification to DEBUG, but no extra information is displayed. Has anyone else experience this problem? Am I doing something wrong? Thanks in advance. /////////////////////////////////////// //Header file MutexTest.h /////////////////////////////////////// #ifndef __MUTEXTEST_H_ #define __MUTEXTEST_H_ #include <OpenThreads/Thread> #include <OpenThreads/Mutex> #include <OpenThreads/Barrier> #include <OpenThreads/Block> #include <OpenThreads/ScopedLock> #include <iostream> class MutexTest : public OpenThreads::Thread { public: MutexTest(); ~MutexTest(); //Functions virtual void run(); void quit(); void printHello(); void setMutex(OpenThreads::Mutex* newValue); OpenThreads::Mutex* getMutex(); private: mutable OpenThreads::Mutex* _mutex; }; #endif /////////////////////////////////////////////////////////////////// //Source file MutexTest.cpp /////////////////////////////////////////////////////////////////// #include "MutexTest.h" MutexTest::MutexTest(){ _mutex = new OpenThreads::Mutex(); } MutexTest::~MutexTest(){ std::cout<<"MutexTest Test Shuting down....."<<std::endl; } void MutexTest::setMutex(OpenThreads::Mutex* newValue){ _mutex = newValue; } OpenThreads::Mutex* MutexTest::getMutex(){ return _mutex; } void MutexTest::quit() { } void MutexTest::printHello(){ OpenThreads::ScopedLock<OpenThreads::Mutex> lock(*_mutex); std::cout<<"-- Mutex Class: Hello --"<<std::endl; } void MutexTest::run() { while(true){ ////////////////////////////////////////////////////////// //This only gets called once when running on 64bit system ///////////////////////////////////////////////////////// printHello(); //sleep OpenThreads::Thread::microSleep(5000); }//while }//run // ------------------------------------------------------------------------ --- // // main // // ------------------------------------------------------------------------ --- int main(int argC, char* argV[]) { //Create a mutex we can share OpenThreads::Mutex* mutable my_mutex = new OpenThreads::Mutex; MutexTest* testMutex = new MutexTest(); testMutex->setMutex(my_mutex); //Start thread testMutex->start(); while(true) { OpenThreads::ScopedLock<OpenThreads::Mutex> lock(*my_mutex); std::cout<<"<<< Main: Hello >>>"<<std::endl; //sleep OpenThreads::Thread::microSleep(2000); }//while return 0; }//main _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org