Boost logo

Boost Users :

Subject: Re: [Boost-users] Boost-users] question about threading library
From: Tan, Tom (Shanghai) (TTan_at_[hidden])
Date: 2008-11-06 22:49:52

Please read this link by the author of boost.thread:,
He also has a personal blog worth reading:

concerning your specific questions:

1. boost::mutex::scoped_lock is just a typedef of unique_lock<mutex>
inside mutex. With this kind of typedef, you'll be able to use the same
type scoped_lock for other kind of mutex(
For example Timed_mutex ) by changing the mutex type only.
There IS the definition on this page:

2. " std::lock_guard is deliberately basic and can only be used as
shown. On the other hand, std::unique_lock allows for deferred locking,
trying to lock, trying to lock with a timeout, and unlocking before the
object is destroyed. "(copied from the first link above)


>From: "Robert Ramey" <ramey_at_[hidden]>
>Subject: [Boost-users] question about threading library
>I want to use the boost threading library in an application.
>Looking through the documentation, I have a questions.

>a) in the examples I find "boost::mutex::scoped_lock" but
>I don't find this in the documentation. It looks like this
>is called "lock_guard". What should I be doing here.

>b) Its not clear to me how unique_lock(Lockable l)
>is different than using lock_gard(..) or scoped_lock.

>Robert Ramey


Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at