projects
/
mono.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
9a9ed94
)
[threadpool] Fix potential infinite loop
author
Ludovic Henry
<ludovic.henry@xamarin.com>
Wed, 1 Apr 2015 15:38:02 +0000
(16:38 +0100)
committer
Ludovic Henry
<ludovic.henry@xamarin.com>
Wed, 1 Apr 2015 15:39:19 +0000
(16:39 +0100)
mono/metadata/threadpool-ms-io.c
patch
|
blob
|
history
diff --git
a/mono/metadata/threadpool-ms-io.c
b/mono/metadata/threadpool-ms-io.c
index 9a7669cf99ed3cebdb881fc6e256f42295f87199..5bc9830d515aa9895ca7b8ce6b3fb525cd2fce5b 100644
(file)
--- a/
mono/metadata/threadpool-ms-io.c
+++ b/
mono/metadata/threadpool-ms-io.c
@@
-806,7
+806,7
@@
polling_thread (gpointer data)
}
mono_mutex_lock (&threadpool_io->states_lock);
- for (i = 0; i < max; ++i) {
+ for (i = 0; i < max
&& ready > 0
; ++i) {
MonoMList *list;
gboolean created;
gint fd;
@@
-830,6
+830,7
@@
polling_thread (gpointer data)
if (fd == threadpool_io->wakeup_pipes [0]) {
polling_thread_drain_wakeup_pipes ();
+ ready -= 1;
continue;
}
@@
-860,8
+861,7
@@
polling_thread (gpointer data)
else
mono_g_hash_table_remove (threadpool_io->states, GINT_TO_POINTER (fd));
- if (-- ready == 0)
- break;
+ ready -= 1;
}
mono_mutex_unlock (&threadpool_io->states_lock);
}