This commit adds in-place pimpl to abstract away the implementation of Mutex. It also adds policies to configure the type of mutex desired. Because of the tight integration between mutex and condition variables they also needed to be reworked and the changes have to be in one commit to retain atomicity. A win32 and pthread implemenation is provided to make sure the api works with both.
31 lines
587 B
C++
31 lines
587 B
C++
/*
|
|
* Copyright (c) 2025, Ryszard Goc <ryszardgoc@gmail.com>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AK/Concepts.h>
|
|
|
|
namespace Sync {
|
|
|
|
struct PolicyNonRecursive { };
|
|
struct PolicyRecursive { };
|
|
struct PolicyIntraprocess { };
|
|
struct PolicyInterprocess { };
|
|
|
|
namespace Detail {
|
|
|
|
template<typename T>
|
|
concept IsIntraprocess = requires {
|
|
requires IsSame<typename T::InterprocessPolicyType, PolicyIntraprocess>;
|
|
};
|
|
|
|
template<typename T>
|
|
concept IsNonRecursive = requires {
|
|
requires IsSame<typename T::RecursivePolicyType, PolicyNonRecursive>;
|
|
};
|
|
|
|
}
|
|
}
|