summaryrefslogtreecommitdiff
path: root/pthread_support.c
diff options
context:
space:
mode:
authorivmai <ivmai>2010-09-30 07:31:16 +0200
committerIvan Maidanski <ivmai@mail.ru>2011-07-26 19:06:55 +0200
commit8a8a9c682df1ec6dc5463e6a52a4d1d9ba8a2678 (patch)
treeea39bc0eb49c2b93a05304a5d7e1714b0b11b3e5 /pthread_support.c
parente3075d4c17fe8c5889d08b645c3986ebe9f6d60a (diff)
2010-09-29 Ivan Maidanski <ivmai@mail.ru>
* darwin_stop_world.c (GC_MAX_MACH_THREADS): New macro. * darwin_stop_world.c (GC_mach_threads, GC_stop_init): Use GC_MAX_MACH_THREADS instead of THREAD_TABLE_SZ. * darwin_stop_world.c (GC_mach_threads): Add FIXME. * darwin_stop_world.c (GC_stop_init, GC_suspend_thread_list, GC_stop_world): Use FALSE and TRUE for already_suspended field and "changed", "found" variables. * darwin_stop_world.c (GC_is_mach_marker): New prototype (only if PARALLEL_MARK). * darwin_stop_world.c (GC_suspend_thread_list): Change return type to GC_bool; change type of "changed", "found" to GC_bool; make "my_thread" as an argument (instead of acquiring/deallocating it locally); do not add my_thread, GC_mach_handler_thread and marker threads to GC_mach_threads table; check for overflow of GC_mach_threads table; increase GC_mach_threads_count if "found" is true and info.suspend_count is non-zero. * darwin_stop_world.c (GC_suspend_thread_list, GC_start_world): Adjust "thread" format specifiers for GC_printf(); search thread in "old_list" starting from the previous found one. * darwin_stop_world.c (GC_stop_world): Rename "changes" to "changed" local variable; remove "result" variable; adjust GC_printf debugging message. * darwin_stop_world.c (GC_start_world): Do not check for my_thread and GC_use_mach_handler_thread (since they are not added to GC_mach_threads table); call thread_info() only if DEBUG_THREADS or GC_ASSERTIONS. * pthread_support.c (marker_mach_threads): New static variable (if Darwin). * pthread_support.c (GC_is_mach_marker): New function (if Darwin). * pthread_support.c (GC_mark_thread): Fill in marker_mach_threads table (if Darwin).
Diffstat (limited to 'pthread_support.c')
-rw-r--r--pthread_support.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/pthread_support.c b/pthread_support.c
index 95fa15e..8688d90 100644
--- a/pthread_support.c
+++ b/pthread_support.c
@@ -321,6 +321,21 @@ static ptr_t marker_sp[MAX_MARKERS - 1] = {0};
static ptr_t marker_bsp[MAX_MARKERS - 1] = {0};
#endif
+#ifdef GC_DARWIN_THREADS
+ static mach_port_t marker_mach_threads[MAX_MARKERS - 1] = {0};
+
+ /* Used only by GC_suspend_thread_list(). */
+ GC_INNER GC_bool GC_is_mach_marker(mach_port_t thread)
+ {
+ int i;
+ for (i = 0; i < GC_markers - 1; i++) {
+ if (marker_mach_threads[i] == thread)
+ return TRUE;
+ }
+ return FALSE;
+ }
+#endif /* GC_DARWIN_THREADS */
+
STATIC void * GC_mark_thread(void * id)
{
word my_mark_no = 0;
@@ -333,6 +348,9 @@ STATIC void * GC_mark_thread(void * id)
# ifdef IA64
marker_bsp[(word)id] = GC_save_regs_in_stack();
# endif
+#ifdef GC_DARWIN_THREADS
+ marker_mach_threads[(word)id] = mach_thread_self();
+#endif
if ((word)id == (word)-1) return 0; /* to make compiler happy */