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
3284f575
Commit
3284f575
authored
Dec 02, 2017
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated to use thread_local instead of old thread_specific_data class.
parent
00910ac1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
8 deletions
+10
-8
stack_trace.cpp
dlib/stack_trace.cpp
+10
-8
No files found.
dlib/stack_trace.cpp
View file @
3284f575
...
...
@@ -8,7 +8,6 @@
#include <sstream>
#include <cstring>
#include "stack_trace.h"
#include "threads.h"
#include "stack.h"
#include "memory_manager.h"
...
...
@@ -31,9 +30,11 @@ namespace dlib
int
line_number
;
};
thread_specific_data
<
stack
<
stack_tracer_data
,
memory_manager
<
char
>::
kernel_2a
>::
kernel_1a
>&
get_dlib_stack_trace_stack
()
using
stack_tracer_stack_type
=
stack
<
stack_tracer_data
,
memory_manager
<
char
>::
kernel_2a
>::
kernel_1a
;
stack_tracer_stack_type
&
get_dlib_stack_trace_stack
()
{
static
thread_specific_data
<
stack
<
stack_tracer_data
,
memory_manager
<
char
>::
kernel_2a
>::
kernel_1a
>
a
;
thread_local
stack_tracer_stack_type
a
;
return
a
;
}
}
...
...
@@ -53,7 +54,7 @@ namespace dlib
data
.
line_number
=
line_number
;
// pop the info onto the function stack trace
get_dlib_stack_trace_stack
().
data
().
push
(
data
);
get_dlib_stack_trace_stack
().
push
(
data
);
}
// ----------------------------------------------------------------------------------------
...
...
@@ -62,7 +63,7 @@ namespace dlib
~
stack_tracer
()
{
stack_tracer_data
temp
;
get_dlib_stack_trace_stack
().
data
().
pop
(
temp
);
get_dlib_stack_trace_stack
().
pop
(
temp
);
}
// ----------------------------------------------------------------------------------------
...
...
@@ -70,10 +71,11 @@ namespace dlib
const
std
::
string
get_stack_trace
()
{
std
::
ostringstream
sout
;
get_dlib_stack_trace_stack
().
data
().
reset
();
while
(
get_dlib_stack_trace_stack
().
data
().
move_next
())
auto
&
stack
=
get_dlib_stack_trace_stack
();
stack
.
reset
();
while
(
stack
.
move_next
())
{
stack_tracer_data
data
=
get_dlib_stack_trace_stack
().
data
()
.
element
();
stack_tracer_data
data
=
stack
.
element
();
sout
<<
data
.
file_name
<<
":"
<<
data
.
line_number
<<
"
\n
"
<<
data
.
funct_name
<<
"
\n
"
;
}
return
sout
.
str
();
...
...
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