Boost logo

Boost :

From: Bjørn Roald (bjorn_at_[hidden])
Date: 2008-02-09 13:58:02

Phil Endecott skrev:
> Clark Sims wrote:
>> Thank you to everybody who responded to my post. I used the solution
>> sugested by several people who said I should use control objects,
>> with the function wait. I posted the final version of my code.
>> The purpose of the project is to create a thread manager which will
>> let threads execute based upon the priority of that thread:
> Hi Clark,
> The operating system provides facilities for setting and changing the
> priorities of threads. (Well, at least POSIX does; I presume that
> Windows does too.) As I understand it, Boost.Threads doesn't provide a
> mechanism to control these priorities. The thread class in C++0x will
> provide a "native handle" that you could use; perhaps it should provide
> a direct way to control the priorities, if there is sufficient
> commonality between the platforms?
> Anyway, I'm curious to know whether the functionality that your
> priority queue implements could have been achieved using O.S.
> facilities, if they had been accessible to you.

I have not studied Clark's code yet, but I think the difference is that
a priority queue can manage priority between messages in the queue prior
to dispach to the worker threads. OS thread priorities can only affect
scheduling of CPU time to the worker threads. Hence, with OS thread
priorities only, a high priority message may have to push a back-log on
the queue of lower priority messages in front of it before it can get
dispached to a worker thread.


Boost list run by bdawes at, gregod at, cpdaniel at, john at