|
Boost : |
Subject: Re: [boost] [Boost.utility]
From: Andrew Chinkoff (achinkoff_at_[hidden])
Date: 2010-01-26 13:07:58
Thread-safe (instance_ == NULL) comparison:
static T& Instance()
{
/**
Perform the Double-Check pattern.
See http://www.research.ibm.com/designpatterns/pubs/ph-jun96.txt.
*/
if (instance_ == NULL)
{
boost::mutex::scoped_lock locker(mtx_instance_);
if (instance_ == NULL)
{
instance_ = new T();
destroyer_.set_doomed(instance_);
}
}
return *instance_;
}
-- View this message in context: http://old.nabble.com/-Boost.utility--tp27309940p27327109.html Sent from the Boost - Dev mailing list archive at Nabble.com.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk