trieser
trieser

Reputation: 121

How to set in proper way priority of one of two threads using pthreads

Example. I want to share getFrame and processFrame in seperated threads. I think that I will make two threads for every action, but I still doesn't know how to set properly priority of threads I mean, I would like to have more priority for getFrame thread than processFrame, but If I have only two threads than I can set a priority for getFrame after created this thread, so the priority will be working after done action by everyone threads. How can I solve it? Maybe I could create a main thread which will make another two threads for getFrame and processFrame and then I set a priority for getFrame thread?

Upvotes: 0

Views: 101

Answers (1)

27harishvk
27harishvk

Reputation: 23

If you are trying to change priority of threads to handle events.. to me it looks like a design of system is very weak.

While designing system it's better never to assume thread priority as it could change from system to system based on settings.

Why don't you send an event to other thread and wait for ack back.

Upvotes: 1

Related Questions