diff options
author | Ivan Maidanski <ivmai@mail.ru> | 2017-08-25 01:05:16 +0300 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2017-08-25 01:05:16 +0300 |
commit | 7d4c5e3e78c47ae64b97c24ba1145b13c1137e26 (patch) | |
tree | f6a5c6180604dd6edc22bcc96d055cc4c6f9970e /win32_threads.c | |
parent | 85fce54e5f3c57c105123de5d4e5f4b027b5eb52 (diff) |
Add debug logging to new_thread about GC_threads hash table collisions
* pthread_support.c [DEBUG_THREADS] (GC_new_thread): Call GC_log_printf
(with the appropriate message) if a GC_threads[] entry already exists
at the given hv index (excluding the detached threads those id is
already reused).
* win32_threads.c [DEBUG_THREADS] (GC_new_thread): Call GC_log_printf
to report that a new thread is created; call GC_log_printf (with the
appropriate message) if a GC_threads[] entry already exists at the
given hv index; remove useless comment about the result of
GC_INTERNAL_MALLOC.
Diffstat (limited to 'win32_threads.c')
-rw-r--r-- | win32_threads.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/win32_threads.c b/win32_threads.c index bce8af93..7befb9bb 100644 --- a/win32_threads.c +++ b/win32_threads.c @@ -338,6 +338,11 @@ STATIC GC_thread GC_new_thread(DWORD id) int hv = THREAD_TABLE_INDEX(id); GC_thread result; +# ifdef DEBUG_THREADS + GC_log_printf("Creating thread 0x%lx\n", (long)id); + if (GC_threads[hv] != NULL) + GC_log_printf("Hash collision at GC_threads[%d]\n", hv); +# endif GC_ASSERT(I_HOLD_LOCK()); if (!EXPECT(first_thread_used, TRUE)) { result = &first_thread; @@ -346,7 +351,6 @@ STATIC GC_thread GC_new_thread(DWORD id) GC_ASSERT(!GC_win32_dll_threads); result = (struct GC_Thread_Rep *) GC_INTERNAL_MALLOC(sizeof(struct GC_Thread_Rep), NORMAL); - /* result can be NULL */ if (result == 0) return(0); } /* result -> id = id; Done by caller. */ |