+2010-10-09 Ivan Maidanski <ivmai@mail.ru>
+
+ * darwin_stop_world.c (GC_mach_thread): Move from
+ darwin_stop_world.h.
+ * include/private/darwin_stop_world.h (GC_mach_thread): Remove.
+ * win32_threads.c (GC_start_world): Define "thread_id" local
+ variable only if GC_ASSERTIONS; decide whether to resume a thread
+ based on its "suspended" field value; assert that suspended thread
+ stack_base is non-zero and the thread is not our one.
+
2010-10-08 Ivan Maidanski <ivmai@mail.ru>
* darwin_stop_world.c (GC_thread_resume): New inline function
#ifndef GC_MAX_MACH_THREADS
# define GC_MAX_MACH_THREADS THREAD_TABLE_SZ
#endif
+
+struct GC_mach_thread {
+ thread_act_t thread;
+ GC_bool already_suspended;
+};
+
static struct GC_mach_thread GC_mach_threads[GC_MAX_MACH_THREADS];
STATIC int GC_mach_threads_count = 0;
/* FIXME: it is better to implement GC_mach_threads as a hash set. */
GC_INNER void GC_start_world(void)
{
- DWORD thread_id = GetCurrentThreadId();
+# ifdef GC_ASSERTIONS
+ DWORD thread_id = GetCurrentThreadId();
+# endif
int i;
GC_ASSERT(I_HOLD_LOCK());
LONG my_max = GC_get_max_thread_index();
for (i = 0; i <= my_max; i++) {
GC_thread t = (GC_thread)(dll_thread_table + i);
- if (t -> stack_base != 0 && t -> suspended
- && t -> id != thread_id) {
+ if (t -> suspended) {
+ GC_ASSERT(t -> stack_base != 0 && t -> id != thread_id);
if (ResumeThread(THREAD_HANDLE(t)) == (DWORD)-1)
ABORT("ResumeThread failed");
t -> suspended = FALSE;
for (i = 0; i < THREAD_TABLE_SZ; i++) {
for (t = GC_threads[i]; t != 0; t = t -> tm.next) {
- if (t -> stack_base != 0 && t -> suspended
- && t -> id != thread_id) {
+ if (t -> suspended) {
+ GC_ASSERT(t -> stack_base != 0 && t -> id != thread_id);
if (ResumeThread(THREAD_HANDLE(t)) == (DWORD)-1)
ABORT("ResumeThread failed");
UNPROTECT_THREAD(t);