projects
/
mono.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
99e9881
)
[threadpool] Use threadpool->threads instead of threadpool->counters to wait on clean...
author
Ludovic Henry
<ludovic@xamarin.com>
Sat, 17 Dec 2016 14:41:36 +0000
(09:41 -0500)
committer
GitHub
<noreply@github.com>
Sat, 17 Dec 2016 14:41:36 +0000
(09:41 -0500)
mono/metadata/threadpool.c
patch
|
blob
|
history
diff --git
a/mono/metadata/threadpool.c
b/mono/metadata/threadpool.c
index cfe2892b375e949f3defab0e49046bf85e2641d0..07db889f26c197b15d71ab64d6992797c6381859 100644
(file)
--- a/
mono/metadata/threadpool.c
+++ b/
mono/metadata/threadpool.c
@@
-187,17
+187,12
@@
cleanup (void)
mono_coop_mutex_lock (&threadpool->threads_lock);
for (;;) {
mono_coop_mutex_lock (&threadpool->threads_lock);
for (;;) {
- ThreadPoolCounter counter;
-
- counter = COUNTER_READ (threadpool);
- if (counter._.working == 0)
+ if (threadpool->threads->len == 0)
break;
break;
- if (counter._.working == 1) {
- if (threadpool->threads->len == 1 && g_ptr_array_index (threadpool->threads, 0) == current) {
- /* We are waiting on ourselves */
- break;
- }
+ if (threadpool->threads->len == 1 && g_ptr_array_index (threadpool->threads, 0) == current) {
+ /* We are waiting on ourselves */
+ break;
}
mono_coop_cond_wait (&threadpool->threads_exit_cond, &threadpool->threads_lock);
}
mono_coop_cond_wait (&threadpool->threads_exit_cond, &threadpool->threads_lock);
@@
-458,16
+453,16
@@
worker_callback (gpointer unused)
mono_coop_mutex_lock (&threadpool->threads_lock);
mono_coop_mutex_lock (&threadpool->threads_lock);
- COUNTER_ATOMIC (threadpool, counter, {
- counter._.working --;
- });
-
g_ptr_array_remove_fast (threadpool->threads, thread);
mono_coop_cond_signal (&threadpool->threads_exit_cond);
mono_coop_mutex_unlock (&threadpool->threads_lock);
g_ptr_array_remove_fast (threadpool->threads, thread);
mono_coop_cond_signal (&threadpool->threads_exit_cond);
mono_coop_mutex_unlock (&threadpool->threads_lock);
+ COUNTER_ATOMIC (threadpool, counter, {
+ counter._.working --;
+ });
+
mono_refcount_dec (threadpool);
}
mono_refcount_dec (threadpool);
}