Is there a way to use some incarnation of ofUrlFileLoader (or something else) that is safe to use in different threads. So far I have used two approaches which both have problems (leading to crashes) primarily it seems because of statics in that class:
My specific use case is I spawn a bunch of threads to first load a file and then parse that file. Since the parsing needs to be done in a separate thread and
-
Using ofSaveUrlTo(…) or any function which calls getFileLoader() for a singleton can cause problems if multiple threads call it. I can work around this by calling getFileLoader() [ via ofRemoveAllURLRequests] in the main thread before any worker threads are spawned. But this only fixes one problem.
-
Creating a thread local ofUrlFileLoader and then calling .saveTo(…) fixes the above but also has a problem because of a static bool factoryLoaded. Again the workaround is to call ofRemoveAllURLRequests() in the main thread before any worker threads. But even if i do that my program crashes (only on exit thoguh in this case) while trying to lock some mutex in SSLManager::shutdown().
Is there anything I can do here short of removing the loading from my threads entirely?
thanks