|
Boost Users : |
From: Caleb Epstein (caleb.epstein_at_[hidden])
Date: 2004-12-23 10:12:00
On Wed, 22 Dec 2004 08:27:48 +0100, Kosta <boost_at_[hidden]> wrote:
> Hi!
>
> I have the following questions about boost.thread:
>
> 1) Did I miss an abstraction about atomic operations, e.g. for ++, --,
> +=, -=, <, ==, =, ... for uint8_t, uint16_t, uint32_t, ... (something like
> InterlockedIncrement() on WIN32)? I know that I can Mutexes and Locks to
> implement the desired behavior, but I think a more lightweight solution for
> this basic operations should be available, too.
See <boost/detail/atomic_count.hpp>. It is not a template, however.
It provides a single type of thread-safe atomic counter which is
convertible to a long.
> 2) How can I change the priority of a boost::thread?
There is no way to do this with Boost.Threads currently.
> 3) boost::shared_ptr<> and boost::weak_ptr<> are not thread safe, are they?
> What is the suggested way to write thread safe implementations of them?
Yes they are. They use the boost::detail::atomic_count under the covers.
-- Caleb Epstein caleb dot epstein at gmail dot com
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