$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
Subject: Re: [Boost-users] [boost::mutex] Do they block or wait?
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2011-03-31 13:49:24
AMDG
On 03/31/2011 09:55 AM, Panagiotis Foteinos wrote:
> I looked into the documentation, but it is still unclear to me.
>
> When a thread locks() an already acquired mutex, does it block (i.e. does it
> do nothing?) releasing all the resources or it loops wasting cpu cycles that
> another thread could utilize? In other words, is boost's locking mechanism
> blocking or spinning?
>
It's an implementation detail. You realize that the
two aren't necessarily mutually exclusive? Anyway,
Boost.Thread does block on an Event. A spin-lock
only makes sense on a multi-core system.
In Christ,
Steven Watanabe