Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
D
dlib
Project
Project
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
钟尚武
dlib
Commits
f4f39597
Commit
f4f39597
authored
Sep 27, 2014
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added scope qualifiers to some mutex objects to avoid a name collision
in newer versions of clang.
parent
ae9701bc
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
3 deletions
+3
-3
parallel_for_ex.cpp
examples/parallel_for_ex.cpp
+2
-2
threads_ex.cpp
examples/threads_ex.cpp
+1
-1
No files found.
examples/parallel_for_ex.cpp
View file @
f4f39597
...
...
@@ -148,7 +148,7 @@ void example_using_lambda_functions()
// parallel for loop is implemented using threads, all the usual techniques for
// ensuring thread safety can be used.
int sum = 0;
mutex m;
dlib::
mutex m;
vect.assign(10, 2);
parallel_for(num_threads, 0, vect.size(), [&](long i){
// The sleep statements still execute in parallel.
...
...
@@ -194,7 +194,7 @@ struct function_object_sum
const
std
::
vector
<
int
>&
vect
;
int
&
sum
;
mutex
m
;
dlib
::
mutex
m
;
void
operator
()
(
long
i
)
const
{
...
...
examples/threads_ex.cpp
View file @
f4f39597
...
...
@@ -23,7 +23,7 @@ using namespace std;
using
namespace
dlib
;
int
thread_count
=
10
;
mutex
count_mutex
;
// This is a mutex we will use to guard the thread_count variable. Note that the mutex doesn't know
dlib
::
mutex
count_mutex
;
// This is a mutex we will use to guard the thread_count variable. Note that the mutex doesn't know
// anything about the thread_count variable. Only our usage of a mutex determines what it guards.
// In this case we are going to make sure this mutex is always locked before we touch the
// thread_count variable.
...
...
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