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-4.0.41 ext/common/Utils/Lock.h
passenger-4.0.40 ext/common/Utils/Lock.h
passenger-4.0.39 ext/common/Utils/Lock.h
passenger-4.0.38 ext/common/Utils/Lock.h
passenger-4.0.37 ext/common/Utils/Lock.h
passenger-4.0.36 ext/common/Utils/Lock.h
passenger-4.0.35 ext/common/Utils/Lock.h
passenger-4.0.34 ext/common/Utils/Lock.h
passenger-4.0.33 ext/common/Utils/Lock.h
passenger-4.0.32 ext/common/Utils/Lock.h
passenger-4.0.31 ext/common/Utils/Lock.h
passenger-4.0.30 ext/common/Utils/Lock.h
passenger-4.0.29 ext/common/Utils/Lock.h
passenger-4.0.28 ext/common/Utils/Lock.h
passenger-4.0.27 ext/common/Utils/Lock.h
passenger-4.0.26 ext/common/Utils/Lock.h
passenger-4.0.25 ext/common/Utils/Lock.h
passenger-4.0.24 ext/common/Utils/Lock.h
passenger-4.0.23 ext/common/Utils/Lock.h
passenger-4.0.21 ext/common/Utils/Lock.h