
14 May
2008
14 May
'08
4:26 p.m.
Peisheng Wang 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); }
Because the scoped_lock declaration goes out of scope at the }. If you had written: #if ISTHREADSAFE { boost::mutex::scoped_lock lock(CacheInfo_mutex); } # endif it would have the same problem.