Sha256: 0d15801e6acf0eaa33e94ca694af5cccda681e4b85d1aa9dc1ee96d02e1d5d91

Contents?: true

Size: 630 Bytes

Versions: 120

Compression:

Stored size: 630 Bytes

Contents

#ifndef _PASSENGER_LOCK_H_
#define _PASSENGER_LOCK_H_

#include <boost/thread.hpp>

namespace Passenger {

using namespace boost;

/** Shortcut typedefs. */
typedef boost::lock_guard<boost::mutex> LockGuard;
typedef boost::unique_lock<boost::mutex> ScopedLock;

/** Nicer syntax for conditionally locking the mutex during construction. */
class DynamicScopedLock: public boost::unique_lock<boost::mutex> {
public:
	DynamicScopedLock(boost::mutex &m, bool lockNow = true)
		: boost::unique_lock<boost::mutex>(m, boost::defer_lock)
	{
		if (lockNow) {
			lock();
		}
	}
};

} // namespace Passenger

#endif /* _PASSENGER_LOCK_H_ */

Version data entries

120 entries across 120 versions & 2 rubygems

Version Path
passenger-5.0.20 src/cxx_supportlib/Utils/Lock.h
passenger-5.0.19 src/cxx_supportlib/Utils/Lock.h
passenger-5.0.18 ext/common/Utils/Lock.h
passenger-5.0.17 ext/common/Utils/Lock.h
passenger-5.0.16 ext/common/Utils/Lock.h
passenger-5.0.15 ext/common/Utils/Lock.h
passenger-5.0.14 ext/common/Utils/Lock.h
passenger-5.0.13 ext/common/Utils/Lock.h
passenger-5.0.11 ext/common/Utils/Lock.h
passenger-5.0.10 ext/common/Utils/Lock.h
passenger-5.0.9 ext/common/Utils/Lock.h
passenger-5.0.8 ext/common/Utils/Lock.h
passenger-5.0.7 ext/common/Utils/Lock.h
passenger-5.0.6 ext/common/Utils/Lock.h
passenger-5.0.5 ext/common/Utils/Lock.h
passenger-5.0.4 ext/common/Utils/Lock.h
passenger-5.0.3 ext/common/Utils/Lock.h
passenger-5.0.2 ext/common/Utils/Lock.h
passenger-5.0.1 ext/common/Utils/Lock.h
passenger-5.0.0.rc2 ext/common/Utils/Lock.h