LeechCraft 0.6.70-18808-g3467692359
Modular cross-platform feature rich live environment.
Loading...
Searching...
No Matches
threadsafety.h
Go to the documentation of this file.
1/**********************************************************************
2 * LeechCraft - modular cross-platform feature rich internet client.
3 * Copyright (C) 2006-2014 Georg Rudoy
4 *
5 * Distributed under the Boost Software License, Version 1.0.
6 * (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
7 **********************************************************************/
8
9#pragma once
10
11#include <mutex>
12#include "task.h"
13#include "context.h"
14
15namespace LC::Util
16{
17 template<typename>
19 {
20 static constexpr bool IsLockingHandler = true;
21 static constexpr bool IsThreadSafe = true;
22
23 mutable std::mutex Mutex_;
24
25 void lock () const
26 {
27 Mutex_.lock ();
28 }
29
30 void unlock () const
31 {
32 Mutex_.unlock ();
33 }
34 };
35
36 template<typename T = void>
38
39 template<typename T = void>
41
42 template<typename T>
43 concept IsThreadSafe = requires { T::IsThreadSafe; };
44}
Task< T, ThreadSafetyExtension > ThreadSafeTask
Task< T, ThreadSafetyExtension, ContextExtension > ThreadSafeContextTask
static constexpr bool IsLockingHandler