pthread_setprio seems to have no effect on a Raspberry

Erich Dollansky erichsfreebsdlist at alogt.com
Sat Aug 1 06:24:34 UTC 2015


Hi,

I wondered that a multi threaded program of mine behaved strangely on a
Raspberry B+. So, it is the old single core version. Not matter what
priorities I give to two threads, I get the same result.

While one thread generates messages and activates a condition, the
second thread reads the condition with pthread_cond_wait.

I assume that on a single core system the reading thread should only
become active after the condition is set ejrm the feeding thread has a
lower priority than the reading thread.

Reality is that the feeding thread is writing first all messages and
the reading threads starts reading them only after the feeding thread
stops feeding no matter which thread has the higher priority. I used
priority values like + and - 100, + and - 1, 0 and +1, 0 and -1 and 1
and 2 in all possible combinations.

When I run the same source on a multi core x86, it looks like one core
is generating while another core is reading. This is what I would
expect under these condition.

All other settings for the two threads are default.

Does anyone have an idea?

Erich


More information about the freebsd-threads mailing list