summaryrefslogtreecommitdiff
path: root/win32_threads.c
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2022-12-31 15:34:25 +0300
committerIvan Maidanski <ivmai@mail.ru>2022-12-31 17:46:39 +0300
commitefc2732cdbd73fd4334ad7e012876c2755c94c51 (patch)
treec6364dec2fb3c2a0b036e5653f2e2e0bfc45ff9c /win32_threads.c
parentfefb50b9cdac116158faf0f99b3ba3f321004463 (diff)
downloadbdwgc-efc2732cdbd73fd4334ad7e012876c2755c94c51.tar.gz
Check out-of-memory and set in_thread_creation inside GC_new_thread
(refactoring) * pthread_support.c (GC_push_thread_structures): Add assertion that first_thread.tm.next and first_thread.status are null. * pthread_support.c (GC_new_thread): Rename id argument to self_id; add assertion that GC_in_thread_creation is off on entrance; set GC_in_thread_creation before GC_INTERNAL_MALLOC() first call and clear it after the second one; if crtn or result is null then ABORT instead of returning NULL. * pthread_support.c [!GC_DISABLE_INCREMENTAL] (GC_wait_for_gc_completion): Add assertion that GC_in_thread_creation is off before it is set. * pthread_support.c [!GC_WIN32_THREADS] (GC_register_my_thread_inner): Do not change GC_in_thread_creation value in this function directly; do not check the result of GC_new_thread(). * win32_threads.c (GC_register_my_thread_inner): Likewise. * win32_threads.c (GC_register_my_thread_inner): Remove assertion that the lock is held.
Diffstat (limited to 'win32_threads.c')
-rw-r--r--win32_threads.c5
1 files changed, 0 insertions, 5 deletions
diff --git a/win32_threads.c b/win32_threads.c
index 46bc62e5..0d1ec5a6 100644
--- a/win32_threads.c
+++ b/win32_threads.c
@@ -241,12 +241,7 @@ GC_INNER GC_thread GC_register_my_thread_inner(const struct GC_stack_base *sb,
} else
# endif
/* else */ /* Not using DllMain */ {
- GC_ASSERT(I_HOLD_LOCK());
- GC_in_thread_creation = TRUE; /* OK to collect from unknown thread. */
me = GC_new_thread(self_id);
- GC_in_thread_creation = FALSE;
- if (NULL == me)
- ABORT("Failed to allocate memory for thread registering");
}
# ifdef GC_PTHREADS
me -> pthread_id = pthread_self();