From 494d64aff614f95d4aa0d34b7d7d7190cdd4ab91 Mon Sep 17 00:00:00 2001 From: Keith Seitz Date: Mon, 23 Apr 2007 21:10:09 +0000 Subject: gc.h (GC_is_thread_suspended): Declare. * include/gc.h (GC_is_thread_suspended): Declare. * pthread_stop_world.c (GC_is_thread_suspended): New function. From-SVN: r124081 --- boehm-gc/ChangeLog | 5 +++++ boehm-gc/include/gc.h | 1 + boehm-gc/pthread_stop_world.c | 8 ++++++++ 3 files changed, 14 insertions(+) (limited to 'boehm-gc') diff --git a/boehm-gc/ChangeLog b/boehm-gc/ChangeLog index aad8839..69f1685 100644 --- a/boehm-gc/ChangeLog +++ b/boehm-gc/ChangeLog @@ -1,3 +1,8 @@ +2007-04-23 Keith Seitz + + * include/gc.h (GC_is_thread_suspended): Declare. + * pthread_stop_world.c (GC_is_thread_suspended): New function. + 2007-04-03 Jakub Jelinek * configure.ac (NO_EXECUTE_PERMISSION): Set by default. diff --git a/boehm-gc/include/gc.h b/boehm-gc/include/gc.h index c6c553d..c51e017 100644 --- a/boehm-gc/include/gc.h +++ b/boehm-gc/include/gc.h @@ -1085,5 +1085,6 @@ GC_API void GC_register_has_static_roots_callback && !defined(GC_WIN32_THREADS) && !defined(GC_DARWIN_THREADS) GC_API void GC_suspend_thread GC_PROTO((pthread_t)); GC_API void GC_resume_thread GC_PROTO((pthread_t)); +GC_API int GC_is_thread_suspended GC_PROTO((pthread_t)); #endif #endif /* _GC_H */ diff --git a/boehm-gc/pthread_stop_world.c b/boehm-gc/pthread_stop_world.c index 211e6b8..bc3c901 100644 --- a/boehm-gc/pthread_stop_world.c +++ b/boehm-gc/pthread_stop_world.c @@ -483,6 +483,14 @@ void GC_resume_thread(pthread_t thread) { t -> flags &= ~SUSPENDED; } +int GC_is_thread_suspended(pthread_t thread) { + GC_thread t = GC_lookup_thread(thread); + if (t == NULL) + ABORT("querying suspension state of unknown thread"); + + return (t -> flags & SUSPENDED); +} + /* Caller holds allocation lock, and has held it continuously since */ /* the world stopped. */ void GC_start_world() -- cgit v1.1