ofxOpenNI icon indicating copy to clipboard operation
ofxOpenNI copied to clipboard

dynamic ofxOpenNI objects with threading

Open timredfern opened this issue 11 years ago • 0 comments

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

timredfern avatar Jul 08 '13 09:07 timredfern