Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tic
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wenyuanbo
tic
Commits
7859058e
Commit
7859058e
authored
Feb 27, 2018
by
Zhixun Tan
Committed by
Tianqi Chen
Feb 27, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Name all the lock guards. (#938)
parent
ca8e31ff
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
9 additions
and
9 deletions
+9
-9
src/codegen/llvm/llvm_common.cc
+1
-1
src/runtime/metal/metal_device_api.mm
+1
-1
src/runtime/opencl/opencl_device_api.cc
+1
-1
src/runtime/registry.cc
+5
-5
src/runtime/vulkan/vulkan_device_api.cc
+1
-1
No files found.
src/codegen/llvm/llvm_common.cc
View file @
7859058e
...
...
@@ -24,7 +24,7 @@ struct LLVMEnv {
void
InitializeLLVM
()
{
LLVMEnv
*
e
=
LLVMEnv
::
Global
();
if
(
!
e
->
all_initialized
)
{
std
::
lock_guard
<
std
::
mutex
>
(
e
->
mu
);
std
::
lock_guard
<
std
::
mutex
>
lock
(
e
->
mu
);
if
(
!
e
->
all_initialized
)
{
e
->
all_initialized
=
true
;
llvm
::
InitializeAllTargetInfos
();
...
...
src/runtime/metal/metal_device_api.mm
View file @
7859058e
...
...
@@ -96,7 +96,7 @@ MetalWorkspace::~MetalWorkspace() {
void MetalWorkspace::Init() {
if (initialized_) return;
std::lock_guard<std::mutex>(this->mutex);
std::lock_guard<std::mutex>
lock
(this->mutex);
if (initialized_) return;
initialized_ = true;
if (devices.size() != 0) return;
...
...
src/runtime/opencl/opencl_device_api.cc
View file @
7859058e
...
...
@@ -180,7 +180,7 @@ bool MatchPlatformInfo(
void
OpenCLWorkspace
::
Init
()
{
if
(
initialized_
)
return
;
std
::
lock_guard
<
std
::
mutex
>
(
this
->
mu
);
std
::
lock_guard
<
std
::
mutex
>
lock
(
this
->
mu
);
if
(
initialized_
)
return
;
initialized_
=
true
;
if
(
context
!=
nullptr
)
return
;
...
...
src/runtime/registry.cc
View file @
7859058e
...
...
@@ -46,7 +46,7 @@ Registry& Registry::set_body(PackedFunc f) { // NOLINT(*)
Registry
&
Registry
::
Register
(
const
std
::
string
&
name
,
bool
override
)
{
// NOLINT(*)
Manager
*
m
=
Manager
::
Global
();
std
::
lock_guard
<
std
::
mutex
>
(
m
->
mutex
);
std
::
lock_guard
<
std
::
mutex
>
lock
(
m
->
mutex
);
auto
it
=
m
->
fmap
.
find
(
name
);
if
(
it
==
m
->
fmap
.
end
())
{
Registry
*
r
=
new
Registry
();
...
...
@@ -62,7 +62,7 @@ Registry& Registry::Register(const std::string& name, bool override) { // NOLIN
bool
Registry
::
Remove
(
const
std
::
string
&
name
)
{
Manager
*
m
=
Manager
::
Global
();
std
::
lock_guard
<
std
::
mutex
>
(
m
->
mutex
);
std
::
lock_guard
<
std
::
mutex
>
lock
(
m
->
mutex
);
auto
it
=
m
->
fmap
.
find
(
name
);
if
(
it
==
m
->
fmap
.
end
())
return
false
;
m
->
fmap
.
erase
(
it
);
...
...
@@ -71,7 +71,7 @@ bool Registry::Remove(const std::string& name) {
const
PackedFunc
*
Registry
::
Get
(
const
std
::
string
&
name
)
{
Manager
*
m
=
Manager
::
Global
();
std
::
lock_guard
<
std
::
mutex
>
(
m
->
mutex
);
std
::
lock_guard
<
std
::
mutex
>
lock
(
m
->
mutex
);
auto
it
=
m
->
fmap
.
find
(
name
);
if
(
it
==
m
->
fmap
.
end
())
return
nullptr
;
return
&
(
it
->
second
->
func_
);
...
...
@@ -79,7 +79,7 @@ const PackedFunc* Registry::Get(const std::string& name) {
std
::
vector
<
std
::
string
>
Registry
::
ListNames
()
{
Manager
*
m
=
Manager
::
Global
();
std
::
lock_guard
<
std
::
mutex
>
(
m
->
mutex
);
std
::
lock_guard
<
std
::
mutex
>
lock
(
m
->
mutex
);
std
::
vector
<
std
::
string
>
keys
;
keys
.
reserve
(
m
->
fmap
.
size
());
for
(
const
auto
&
kv
:
m
->
fmap
)
{
...
...
@@ -101,7 +101,7 @@ ExtTypeVTable* ExtTypeVTable::RegisterInternal(
int
type_code
,
const
ExtTypeVTable
&
vt
)
{
CHECK
(
type_code
>
kExtBegin
&&
type_code
<
kExtEnd
);
Registry
::
Manager
*
m
=
Registry
::
Manager
::
Global
();
std
::
lock_guard
<
std
::
mutex
>
(
m
->
mutex
);
std
::
lock_guard
<
std
::
mutex
>
lock
(
m
->
mutex
);
ExtTypeVTable
*
pvt
=
&
(
m
->
ext_vtable
[
type_code
]);
pvt
[
0
]
=
vt
;
return
pvt
;
...
...
src/runtime/vulkan/vulkan_device_api.cc
View file @
7859058e
...
...
@@ -650,7 +650,7 @@ std::vector<VulkanContext> GetContext(VkInstance instance) {
void
VulkanWorkspace
::
Init
()
{
if
(
initialized_
)
return
;
std
::
lock_guard
<
std
::
mutex
>
(
this
->
mu
);
std
::
lock_guard
<
std
::
mutex
>
lock
(
this
->
mu
);
if
(
initialized_
)
return
;
initialized_
=
true
;
instance_
=
CreateInstance
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment