Esempio n. 1
1
		void lock()
		{
			using namespace std::chrono;

			if (_m.try_lock())
				return;

			detail::threading_primitive_guard g;

			if (g.should_detect_deadlocks())
			{
				auto d = milliseconds(TimeoutMs_);
				detail::timer t;
				while (!_m.try_lock_for(d))
					LoggerPolicy_::show_message(detail::make_log_message("Could not lock mutex", get_id(), t.elapsed()));
			}
			else
				_m.lock();
		}
Esempio n. 2
0
		bool try_lock()
		{ return _m.try_lock(); }