summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pthread_support.c3
-rw-r--r--win32_threads.c11
2 files changed, 6 insertions, 8 deletions
diff --git a/pthread_support.c b/pthread_support.c
index bc02a0f6..00d374fc 100644
--- a/pthread_support.c
+++ b/pthread_support.c
@@ -1796,7 +1796,8 @@ GC_API int WRAP_FUNC(pthread_create)(pthread_t *new_thread,
if (NULL == attr) {
detachstate = PTHREAD_CREATE_JOINABLE;
} else {
- pthread_attr_getdetachstate(attr, &detachstate);
+ if (pthread_attr_getdetachstate(attr, &detachstate) != 0)
+ ABORT("pthread_attr_getdetachstate failed");
}
if (PTHREAD_CREATE_DETACHED == detachstate) my_flags |= DETACHED;
si -> flags = my_flags;
diff --git a/win32_threads.c b/win32_threads.c
index 5041543c..73f1e7a9 100644
--- a/win32_threads.c
+++ b/win32_threads.c
@@ -2668,7 +2668,7 @@ GC_INNER void GC_thr_init(void)
struct start_info {
void *(*start_routine)(void *);
void *arg;
- GC_bool detached;
+ int detached;
};
GC_API int GC_pthread_join(pthread_t pthread_id, void **retval)
@@ -2740,12 +2740,9 @@ GC_INNER void GC_thr_init(void)
si -> arg = arg;
GC_dirty(si);
REACHABLE_AFTER_DIRTY(arg);
- if (attr != 0 &&
- pthread_attr_getdetachstate(attr, &si->detached)
- == PTHREAD_CREATE_DETACHED) {
- si->detached = TRUE;
- }
-
+ if (attr != NULL
+ && pthread_attr_getdetachstate(attr, &(si -> detached)) != 0)
+ ABORT("pthread_attr_getdetachstate failed");
# ifdef DEBUG_THREADS
GC_log_printf("About to create a thread from %p(0x%lx)\n",
GC_PTHREAD_PTRVAL(pthread_self()),