essentia
essentia copied to clipboard
Make Logger objects thread safe using a mutex.
unfortunately, std::mutex comes only with C++11 and Essentia still needs to support older compilers, so it won't be possible to merge that... However you could replace it with an essentia::MutexLocker (https://github.com/MTG/essentia/blob/master/src/essentia/threading.h#L43) and then I would merge it. (an example here: https://github.com/MTG/essentia/blob/master/src/essentia/streaming/phantombuffer.h#L169)
It is better to use the mutexlocker rather that mutex.lock() and mutex.unlock() directly for this reason: http://en.wikipedia.org/wiki/Resource_Acquisition_Is_Initialization
You will also note that at the moment, the implementations for Mutex and MutexLocker are empty, due to the fact that essentia 2.0 only supports running a network in a single-thread. If you wanted to run them multithreaded, you would need to add an #ifdef to threading.h and provide a real implementation for Mutex and MutexLocker (the same as ForcedMutex and ForcedMutexLocker, actually). But the benefits of doing that are unclear, see my comments in your other issue.
Reopening this, as we are C++11 by now.
There is any update here? I'm having the same issues reported on #798 .
Would this fix the annoying [ WARNING ] No network created, or last created network has been deleted...
message?