gameoverhack / ofxOpenNI

Wrapper for OpenNI, NITE and SensorKinect
gingold.com.au
Other
246 stars 121 forks source link

dynamic ofxOpenNI objects with threading #38

Open timredfern opened 11 years ago

timredfern commented 11 years ago

Hello, I've been trying to make a project that plays back .oni files by creating and deleting ofxOpenNI objects. (I find that if I initialise the objects afetr they are created then threading doesn't work, hence this approach).

I'm running into problems while deleting the objects. updateUserTracker(); is often called after the usertacker is deleted, causing a crash.

Looking at the source code, I notice this commented out statement in ofxOpenNI::stop(); , ofxOpenNI.cpp line 349

//waitForThread(true);

I've found that if I uncomment this, but comment out the mutex.lock() on line 345, creating and deleting objects works perfectly and I still get multithreaded performance.

Why was this line commented out? Does this approach cause problems elsewhere?

I'm using x64 linux and the git version of OF. I believe I'm seeing identical results on OSX with the latest published version.

Tim Redfern