summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Seitz <keiths@redhat.com>2007-04-23 21:10:09 +0000
committerIvan Maidanski <ivmai@mail.ru>2015-11-20 01:34:53 +0300
commitd34d5b53d67b3ef6fa2d70a945e21f023cb9e3e7 (patch)
tree669d8261eb05049a21e21afee885c79b92473771
parent0dae57c4db20c1ebc22d8cc6e9ed0531f6c12652 (diff)
downloadbdwgc-d34d5b53d67b3ef6fa2d70a945e21f023cb9e3e7.tar.gz
Add GC_is_thread_suspended API function
(Cherry-picked commit 30c2f0e from 'gcc_boehmgc' branch.) * include/gc.h (GC_is_thread_suspended): Declare. * pthread_stop_world.c (GC_is_thread_suspended): New function. Conflicts: * ChangeLog * include/gc.h * pthread_stop_world.c
-rw-r--r--include/gc.h1
-rw-r--r--pthread_stop_world.c8
2 files changed, 9 insertions, 0 deletions
diff --git a/include/gc.h b/include/gc.h
index d9f4e397..f8f764e1 100644
--- a/include/gc.h
+++ b/include/gc.h
@@ -1921,6 +1921,7 @@ GC_API void GC_CALL GC_win32_free_heap(void);
&& !defined(GC_WIN32_THREADS) && !defined(GC_DARWIN_THREADS)
GC_API void GC_suspend_thread(pthread_t);
GC_API void GC_resume_thread(pthread_t);
+GC_API int GC_is_thread_suspended(pthread_t);
#endif
#ifdef __cplusplus
diff --git a/pthread_stop_world.c b/pthread_stop_world.c
index f9e86c55..d8096332 100644
--- a/pthread_stop_world.c
+++ b/pthread_stop_world.c
@@ -412,6 +412,14 @@ void GC_resume_thread(pthread_t thread) {
t -> flags &= ~SUSPENDED_EXT;
}
+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_EXT);
+}
+
#endif /* !GC_OPENBSD_UTHREADS && !NACL */
#ifdef IA64