summaryrefslogtreecommitdiff
path: root/win32_threads.c
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2012-02-27 18:49:35 +0100
committerIvan Maidanski <ivmai@mail.ru>2012-02-27 18:59:40 +0100
commit1d8a51bb874682ef25005cf8cadd881d8d12cf9a (patch)
treef865ba773708f5e132bdfe089a213fce44d99549 /win32_threads.c
parente668a4c5ad9bc34b24175d3383a05898748ba820 (diff)
Fix GC_register_my_thread marking thread as detached (Cygwin/pthreads-w32)
* win32_threads.c (GC_register_my_thread): Fix SEGV by setting "me" to the newly-created thread GC descriptor (if lookup failed) before altering flags of "me" (only if GC_PTHREADS); add comment (same as in pthread_support.c).
Diffstat (limited to 'win32_threads.c')
-rw-r--r--win32_threads.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/win32_threads.c b/win32_threads.c
index af2ccd9..0d8d3a7 100644
--- a/win32_threads.c
+++ b/win32_threads.c
@@ -723,9 +723,13 @@ GC_API int GC_CALL GC_register_my_thread(const struct GC_stack_base *sb)
LOCK();
me = GC_lookup_thread_inner(thread_id);
if (me == 0) {
- GC_register_my_thread_inner(sb, thread_id);
# ifdef GC_PTHREADS
+ me = GC_register_my_thread_inner(sb, thread_id);
me -> flags |= DETACHED;
+ /* Treat as detached, since we do not need to worry about */
+ /* pointer results. */
+# else
+ GC_register_my_thread_inner(sb, thread_id);
# endif
UNLOCK();
return GC_SUCCESS;