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
a8384d39
Commit
a8384d39
authored
Apr 05, 2017
by
Davis King
Browse files
Options
Browse Files
Download
Plain Diff
merged
parents
373cbb57
9dad00ec
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
0 deletions
+27
-0
timer.cpp
dlib/timer/timer.cpp
+27
-0
No files found.
dlib/timer/timer.cpp
View file @
a8384d39
...
...
@@ -24,11 +24,38 @@ namespace dlib
timer_global_clock
::
~
timer_global_clock
()
{
// The only time this destructor is called is when
//
// a) the process terminates
// b) the dynamic library(.so/.dll) is unloaded (could be a part of a))
//
// in case of a)
// windows: the process termination is especially painful, since threads are killed
// before destructors of the process image .dll's are called.
// Thus, for the windows platform, there is no threads running, so the only thing
// to do here is just let the standard memberwise destructors run
// linux: it's ok to just signal shutdown and wait for the running thread, to exit
//
// in case of b)
// windows:
// if it's part of the termination process, a) applies
// if its part of user doing manual load_library/unload_library
// there is no (safe/robust)solution, but best practices are described here
// https://msdn.microsoft.com/en-us/library/windows/desktop/dn633971.aspx
// to support such a clean shutdown, you are required to make a call prior to
// unload dll, that shutdown all the threads in the contained dll.
// This could be done in this module by providing a global_delete_clock()
//
// linux: the destructor for linux will do it's usual job regardless.
//
#ifndef _WIN32
m
.
lock
();
shutdown
=
true
;
s
.
signal
();
m
.
unlock
();
wait
();
#endif
}
// ----------------------------------------------------------------------------------------
...
...
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