DPC++ Runtime
Runtime libraries for oneAPI DPC++
locked.hpp
Go to the documentation of this file.
1
//==---------------- locked.hpp - Reference with lock -----------*- C++-*---==//
2
//
3
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
// See https://llvm.org/LICENSE.txt for license information.
5
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
//
7
//===----------------------------------------------------------------------===//
8
9
#pragma once
10
11
#include <
CL/sycl/detail/defines.hpp
>
12
13
#include <functional>
14
#include <mutex>
15
16
__SYCL_INLINE_NAMESPACE
(
cl
) {
17
namespace
sycl
{
18
namespace
detail {
23
template
<
typename
T>
24
class
Locked
{
25
std::reference_wrapper<T> m_Value;
26
std::unique_lock<std::mutex> m_Lock;
27
28
public
:
29
Locked
(
T
&v, std::mutex &mutex)
30
: m_Value{v}, m_Lock{mutex}
31
{}
32
33
T
&
get
()
const
{
34
return
m_Value.get();
35
}
36
};
37
}
38
}
39
}
cl::sycl::detail::Locked
Represents a reference to value with appropriate lock acquired.
Definition:
locked.hpp:24
T
sycl
Definition:
invoke_simd.hpp:68
cl::sycl::detail::Locked::Locked
Locked(T &v, std::mutex &mutex)
Definition:
locked.hpp:29
defines.hpp
cl
We provide new interfaces for matrix muliply in this patch:
Definition:
access.hpp:13
cl::sycl::detail::Locked::get
T & get() const
Definition:
locked.hpp:33
__SYCL_INLINE_NAMESPACE
#define __SYCL_INLINE_NAMESPACE(X)
Definition:
defines_elementary.hpp:12
include
CL
sycl
detail
locked.hpp
Generated by
1.8.17