Add GC_is_thread_suspended API function
authorKeith Seitz <keiths@redhat.com>
Mon, 23 Apr 2007 21:10:09 +0000 (21:10 +0000)
committerIvan Maidanski <ivmai@mail.ru>
Thu, 19 Nov 2015 22:34:53 +0000 (01:34 +0300)
(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

include/gc.h
pthread_stop_world.c

index d9f4e39..f8f764e 100644 (file)
@@ -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
index f9e86c5..d809633 100644 (file)
@@ -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