Poco Threads - Intended/preferred method of updating after 0.10/Poco removal


#1

Hey all -

Getting back into OF a little bit recently and decided to get back into 0.10 so I can learn all the new changes.

I’m trying to see if I can update another person’s addon to use 0.10 and the removal of Poco. The addon in question has a couple things in it like this and I’m wondering what the intended or preferred replacement might be:

getPocoThread().setPriority(Poco::Thread::PRIO_HIGHEST);

In this particular addon, setting thread priority might not be that important, and i can just comment it out, but maybe there is something I’m missing? Would I need to create a more explicit poco object for setting priority, or would that not play well with ofThread?

Thanks!


#2

ofThread now uses std::thread http://en.cppreference.com/w/cpp/thread/thread which atm doens’t have multiplatform support to set the priority of the thread. you could get the native handle http://en.cppreference.com/w/cpp/thread/thread/native_handle and then use pthread_setschedparam http://man7.org/linux/man-pages/man3/pthread_setschedparam.3.html to set the priority on the native handle in every platform except windows where you’ll need https://msdn.microsoft.com/en-us/library/windows/desktop/ms686277(v=vs.85).aspx