Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dlib
Commits
d6c20069
Commit
d6c20069
authored
Dec 28, 2012
by
Davis King
Browse files
Added auto_mutex::unlock()
parent
213b0ff1
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
4 deletions
+27
-4
dlib/threads/auto_mutex_extension.h
dlib/threads/auto_mutex_extension.h
+17
-3
dlib/threads/auto_mutex_extension_abstract.h
dlib/threads/auto_mutex_extension_abstract.h
+10
-1
No files found.
dlib/threads/auto_mutex_extension.h
View file @
d6c20069
...
...
@@ -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 @
d6c20069
...
...
@@ -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
unlock
ed
-
calls
unlock
()
!*/
private:
...
...
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