comments below:
Delfin Rojas <drojas@moodlogic.com> wrote:
> Calderon Hector wrote:I still don't see how this could be done system-wide.
>
> 1.- I don't see how to lock a file (fstream) for
> reading/writing. Do I have to use OS functions?
As far as I know there is no "lockable fstream" class in boost. You should
be able to implement it yourself using a mutex. In other words, you can use
the fstream as a shared resource and lock the mutex before each read and
write. You may want to look into the iostreams library and create a
thread_safe_iostream.
I think that boost::thread should have functions like hike_up() and slack() that try to change the priority of a thread. They would attempt to change a thread priority. Since it would be only a suggestion (just like string::resize is not mandatory), it would not be a problem for cross-platform support.
> 2.- How do I set a thread to be low priority? Do I have to go
> to the OS again?
>From old postings I remember the objection to this functionality was
cross-platform support. There doesn't seem to be a consistent way to set
thread priority across all the OSes supported by boost.thread. However this
is only my recollection.