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.0.rc1 ext/common/Utils/Lock.h
passenger-4.0.59 ext/common/Utils/Lock.h
passenger-5.0.0.beta3 ext/common/Utils/Lock.h
passenger-4.0.58 ext/common/Utils/Lock.h
passenger-4.0.57 ext/common/Utils/Lock.h
passenger-5.0.0.beta2 ext/common/Utils/Lock.h
passenger-4.0.56 ext/common/Utils/Lock.h
passenger-4.0.55 ext/common/Utils/Lock.h
passenger-5.0.0.beta1 ext/common/Utils/Lock.h
passenger-4.0.53 ext/common/Utils/Lock.h
passenger-4.0.52 ext/common/Utils/Lock.h
passenger-4.0.51 ext/common/Utils/Lock.h
passenger-4.0.50 ext/common/Utils/Lock.h
passenger-4.0.49 ext/common/Utils/Lock.h
passenger-4.0.48 ext/common/Utils/Lock.h
passenger-4.0.46 ext/common/Utils/Lock.h
passenger-4.0.45 ext/common/Utils/Lock.h
passenger-4.0.44 ext/common/Utils/Lock.h
passenger-4.0.43 ext/common/Utils/Lock.h
passenger-4.0.42 ext/common/Utils/Lock.h