Thread::setOSPriority() on POSIX systems

Discussion of ideas for features and new projects based on POCO.
Posts: 2
Joined: 11 May 2009, 22:17

Thread::setOSPriority() on POSIX systems

Postby ChrisL » 13 Jun 2009, 07:11

The ThreadImpl class for POSIX systems is setting the scheduling policy of SCHED_OTHER. On Linux this is the default scheduling policy and there are in fact no priorities supported (Min 0, Max 0). I don't have access to a Solaris box right now so I can't say for sure what the behavior is there. I'd like to see support for SCHED_FIFO or SCHED_RR, where priorities can actually be specified. SCHED_FIFO or SCHED_RR are going to be a lot more applicable to embedded/soft real-time applications.

The downside to defaulting to SCHED_FIFO or SCHED_RR is the permissions that may be required to set the scheduling policy or priority.

Could the notion of scheduling policy be exposed as part of the Thread interface, even though support would vary by OS (Windows obviously doesn't support it, and support will vary depending on the level of POSIX support of other OSes):

class Thread {
enum Policy {

Policy getPolicy() const;

void setPolicy(int policy);


Any thoughts?


Posts: 1375
Joined: 11 Jul 2006, 16:27
Location: United_States

Re: Thread::setOSPriority() on POSIX systems

Postby alex » 14 Jun 2009, 13:34

ChrisL wrote:Any thoughts?

I think this would be useful. For the proposal not to get lost, file a SF feature request and someone will look into it somewhere down the road.

Return to “Wishlist”

Who is online

Users browsing this forum: No registered users and 1 guest