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-6.0.24 src/cxx_supportlib/Utils/Lock.h
passenger-6.0.23 src/cxx_supportlib/Utils/Lock.h
passenger-6.0.20 src/cxx_supportlib/Utils/Lock.h
passenger-6.0.19 src/cxx_supportlib/Utils/Lock.h
passenger-6.0.18 src/cxx_supportlib/Utils/Lock.h
passenger-6.0.17 src/cxx_supportlib/Utils/Lock.h
passenger-6.0.16 src/cxx_supportlib/Utils/Lock.h
passenger-6.0.15 src/cxx_supportlib/Utils/Lock.h
passenger-6.0.14 src/cxx_supportlib/Utils/Lock.h
passenger-6.0.13 src/cxx_supportlib/Utils/Lock.h
passenger-6.0.12 src/cxx_supportlib/Utils/Lock.h
passenger-6.0.11 src/cxx_supportlib/Utils/Lock.h
passenger-6.0.10 src/cxx_supportlib/Utils/Lock.h
passenger-6.0.9 src/cxx_supportlib/Utils/Lock.h
passenger-6.0.8 src/cxx_supportlib/Utils/Lock.h
passenger-6.0.7 src/cxx_supportlib/Utils/Lock.h
passenger-6.0.6 src/cxx_supportlib/Utils/Lock.h
passenger-6.0.5 src/cxx_supportlib/Utils/Lock.h
passenger-6.0.4 src/cxx_supportlib/Utils/Lock.h
passenger-6.0.3 src/cxx_supportlib/Utils/Lock.h