$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
From: dhruva (dhruvakm_at_[hidden])
Date: 2008-05-14 00:50:52
On 5/14/08, Peisheng Wang <peisheng.wang_at_[hidden]> wrote:
> Why
>
> #if ISTHREADSAFE
> boost::mutex::scoped_lock lock(CacheInfo_mutex);
> # endif
>
> functions well , but not
>
> if(isThreadSafe)
> {
> boost::mutex::scoped_lock lock(CacheInfo_mutex);
> }
The valriable 'lock' is created in the local scope and will get
destroyed once you are out of the 'if' scope. Also, use of macros for
things that do not change at runtime is better as it avoids the
runtime overhead of performing the check.
-dky
-- Contents reflect my personal views only!