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
1a6554bc
Commit
1a6554bc
authored
Dec 29, 2012
by
Davis King
Browse files
Options
Browse Files
Download
Plain Diff
merged
parents
68e88433
d5ca4a8b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
8 deletions
+31
-8
auto_mutex_extension.h
dlib/threads/auto_mutex_extension.h
+17
-3
auto_mutex_extension_abstract.h
dlib/threads/auto_mutex_extension_abstract.h
+10
-1
thread_pool_extension.cpp
dlib/threads/thread_pool_extension.cpp
+1
-1
thread_pool_extension.h
dlib/threads/thread_pool_extension.h
+3
-3
No files found.
dlib/threads/auto_mutex_extension.h
View file @
1a6554bc
...
...
@@ -63,15 +63,29 @@ namespace dlib
rw
->
lock
();
}
~
auto_mutex
(
)
void
unlock
()
{
if
(
m
!=
0
)
{
m
->
unlock
();
m
=
0
;
}
else
if
(
r
!=
0
)
{
r
->
unlock
();
else
r
=
0
;
}
else
if
(
rw
!=
0
)
{
rw
->
unlock
();
rw
=
0
;
}
}
~
auto_mutex
(
)
{
unlock
();
}
private
:
...
...
dlib/threads/auto_mutex_extension_abstract.h
View file @
1a6554bc
...
...
@@ -52,12 +52,21 @@ namespace dlib
- m will be locked via m.lock() (i.e. a write lock will be obtained)
!*/
void
unlock
(
);
/*!
ensures
- if (unlock() has not already been called) then
- The mutex associated with *this has been unlocked. This is useful if
you want to unlock a mutex before the auto_mutex destructor executes.
!*/
~
auto_mutex
(
);
/*!
ensures
- all resources allocated by *this have been freed
-
the mutex associated with *this has been unlocked
-
calls unlock()
!*/
private
:
...
...
dlib/threads/thread_pool_extension.cpp
View file @
1a6554bc
...
...
@@ -275,7 +275,7 @@ namespace dlib
// aren't any other worker threads free so just perform the task right
// here
m
.
unlock
();
M
.
unlock
();
bfp
();
// return a task id that is both non-zero and also one
...
...
dlib/threads/thread_pool_extension.h
View file @
1a6554bc
...
...
@@ -182,7 +182,7 @@ namespace dlib
// aren't any other worker threads free so just perform the task right
// here
m
.
unlock
();
M
.
unlock
();
(
obj
.
*
funct
)();
// return a task id that is both non-zero and also one
...
...
@@ -225,7 +225,7 @@ namespace dlib
// aren't any other worker threads free so just perform the task right
// here
m
.
unlock
();
M
.
unlock
();
(
obj
.
*
funct
)(
arg1
);
// return a task id that is both non-zero and also one
...
...
@@ -270,7 +270,7 @@ namespace dlib
// aren't any other worker threads free so just perform the task right
// here
m
.
unlock
();
M
.
unlock
();
(
obj
.
*
funct
)(
arg1
,
arg2
);
// return a task id that is both non-zero and also one
...
...
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