projects
/
mono.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
ad4eb74
)
[threadpool] Make sure we check if the runtime is shutting down in case of interruption
author
Ludovic Henry
<ludovic@xamarin.com>
Wed, 8 Feb 2017 19:32:00 +0000
(14:32 -0500)
committer
Ludovic Henry
<ludovic@xamarin.com>
Thu, 16 Feb 2017 20:36:44 +0000
(15:36 -0500)
mono/metadata/threadpool.c
patch
|
blob
|
history
diff --git
a/mono/metadata/threadpool.c
b/mono/metadata/threadpool.c
index 455d616a767ac5655ca221cdb0c53ff8d579a38e..7f7c31f0631ab5d5bc279212b98d939f369ce43b 100644
(file)
--- a/
mono/metadata/threadpool.c
+++ b/
mono/metadata/threadpool.c
@@
-309,11
+309,11
@@
static ThreadPoolDomain *
tpdomain_get_next (ThreadPoolDomain *current)
{
ThreadPoolDomain *tpdomain = NULL;
tpdomain_get_next (ThreadPoolDomain *current)
{
ThreadPoolDomain *tpdomain = NULL;
- g
u
int len;
+ gint len;
len = threadpool.domains->len;
if (len > 0) {
len = threadpool.domains->len;
if (len > 0) {
- g
u
int i, current_idx = -1;
+ gint i, current_idx = -1;
if (current) {
for (i = 0; i < len; ++i) {
if (current == g_ptr_array_index (threadpool.domains, i)) {
if (current) {
for (i = 0; i < len; ++i) {
if (current == g_ptr_array_index (threadpool.domains, i)) {
@@
-321,7
+321,6
@@
tpdomain_get_next (ThreadPoolDomain *current)
break;
}
}
break;
}
}
- g_assert (current_idx != (guint)-1);
}
for (i = current_idx + 1; i < len + current_idx + 1; ++i) {
ThreadPoolDomain *tmp = (ThreadPoolDomain *)g_ptr_array_index (threadpool.domains, i % len);
}
for (i = current_idx + 1; i < len + current_idx + 1; ++i) {
ThreadPoolDomain *tmp = (ThreadPoolDomain *)g_ptr_array_index (threadpool.domains, i % len);
@@
-388,9
+387,12
@@
worker_callback (gpointer unused)
while (!mono_runtime_is_shutting_down ()) {
gboolean retire = FALSE;
while (!mono_runtime_is_shutting_down ()) {
gboolean retire = FALSE;
- if (
(thread->state & (ThreadState_AbortRequested | ThreadState_SuspendRequested)) != 0
) {
+ if (
thread->state & (ThreadState_AbortRequested | ThreadState_SuspendRequested)
) {
domains_unlock ();
domains_unlock ();
- mono_thread_interruption_checkpoint ();
+ if (mono_thread_interruption_checkpoint ()) {
+ domains_lock ();
+ continue;
+ }
domains_lock ();
}
domains_lock ();
}