Boost logo

Boost Users :

From: Calderon Hector (hhcalderon_at_[hidden])
Date: 2006-03-01 14:31:44


comments below:

Delfin Rojas <drojas_at_[hidden]> wrote: > Calderon Hector wrote:
>
> 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 still don't see how this could be done system-wide.

> 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.

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.

++Hector C.

PS. Are you implying that boost gods have a policy like "If it doesn't work consistenly for all supported OS, then it's not for boost"?

----------------------------------
                
---------------------------------
Brings words and photos together (easily) with
 PhotoMail - it's free and works with Yahoo! Mail.



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net