Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SWIFT
SWIFTsim
Commits
3984768d
Commit
3984768d
authored
Jul 26, 2017
by
Pedro Gonnet
Browse files
take the thread id from the number of running threads, not waiting threads.
parent
9a634a15
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/threadpool.c
View file @
3984768d
...
...
@@ -136,9 +136,6 @@ void *threadpool_runner(void *data) {
/* Let the controller know that this thread is waiting. */
pthread_mutex_lock
(
&
tp
->
thread_mutex
);
#ifdef SWIFT_DEBUG_THREADPOOL
const
int
tid
=
tp
->
num_threads_waiting
;
#endif
tp
->
num_threads_waiting
+=
1
;
if
(
tp
->
num_threads_waiting
==
tp
->
num_threads
)
{
pthread_cond_signal
(
&
tp
->
control_cond
);
...
...
@@ -147,6 +144,9 @@ void *threadpool_runner(void *data) {
/* Wait for the controller. */
pthread_cond_wait
(
&
tp
->
thread_cond
,
&
tp
->
thread_mutex
);
tp
->
num_threads_waiting
-=
1
;
#ifdef SWIFT_DEBUG_THREADPOOL
const
int
tid
=
tp
->
num_threads_running
;
#endif
tp
->
num_threads_running
+=
1
;
if
(
tp
->
num_threads_running
==
tp
->
num_threads
)
{
pthread_cond_signal
(
&
tp
->
control_cond
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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