mirror of
https://github.com/davisking/dlib.git
synced 2024-11-01 10:14:53 +08:00
Added scope qualifiers to some mutex objects to avoid a name collision
in newer versions of clang.
This commit is contained in:
parent
ae9701bcca
commit
f4f395975e
@ -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
|
||||
{
|
||||
|
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user