Created
November 24, 2011 19:35
-
-
Save kumpera/1392098 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/mono/metadata/sgen-os-posix.c b/mono/metadata/sgen-os-posix.c | |
index 0a0c4f1..874b039 100644 | |
--- a/mono/metadata/sgen-os-posix.c | |
+++ b/mono/metadata/sgen-os-posix.c | |
@@ -127,6 +127,7 @@ suspend_handler (int sig, siginfo_t *siginfo, void *context) | |
int old_errno = errno; | |
info = mono_thread_info_current (); | |
+ printf ("THREAD %p got suspend signal info %p\n", (gpointer)pthread_self (), info); | |
if (info) { | |
suspend_thread (info, context); | |
@@ -177,11 +178,13 @@ mono_sgen_wait_for_suspend_ack (int count) | |
for (i = 0; i < count; ++i) { | |
while ((result = MONO_SEM_WAIT (suspend_ack_semaphore_ptr)) != 0) { | |
+ printf ("\t %d done\n", i + i); | |
if (errno != EINTR) { | |
g_error ("sem_wait ()"); | |
} | |
} | |
} | |
+ printf ("FINISHED WAITING\n"); | |
} | |
gboolean | |
@@ -200,9 +203,10 @@ mono_sgen_thread_handshake (BOOL suspend) | |
int count, result; | |
SgenThreadInfo *info; | |
int signum = suspend ? suspend_signal_num : restart_signal_num; | |
- | |
MonoNativeThreadId me = mono_native_thread_id_get (); | |
+ printf ("HANDSHAKE for %s\n", suspend ? "suspend" : "restart"); | |
+ | |
count = 0; | |
FOREACH_THREAD_SAFE (info) { | |
if (mono_native_thread_id_equals (mono_thread_info_get_tid (info), me)) { | |
@@ -218,6 +222,7 @@ mono_sgen_thread_handshake (BOOL suspend) | |
info->doing_handshake = FALSE; | |
} | |
result = pthread_kill (mono_thread_info_get_tid (info), signum); | |
+ printf ("\tpkill %p -> %d\n", (gpointer)mono_thread_info_get_tid (info), result); | |
if (result == 0) { | |
count++; | |
} else { | |
@@ -225,6 +230,7 @@ mono_sgen_thread_handshake (BOOL suspend) | |
} | |
} END_FOREACH_THREAD_SAFE | |
+ printf ("SIGNALLED %d threads\n", count); | |
mono_sgen_wait_for_suspend_ack (count); | |
return count; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment