]> granicus.if.org Git - gc/commitdiff
2005-03-03 Zoltan Varga <vargaz@freemail.hu>
authorZoltan Varga <vargaz@gmail.com>
Thu, 3 Mar 2005 21:09:34 +0000 (21:09 +0000)
committerguest <ivmai@mail.ru>
Fri, 29 Jul 2011 11:24:19 +0000 (15:24 +0400)
* include/gc.h pthread_support.c win32_threads.: Add
GC_thread_is_registered API function.

svn path=/trunk/mono/; revision=41410

ChangeLog
include/gc.h
pthread_support.c
win32_threads.c

index 4b6d7ef44f4f7be1cc7def4b7e7335ce0f0305b7..9f0c7bdc678a8bc0ea4d904cbd5a4ed236a4f080 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2005-03-03  Zoltan Varga  <vargaz@freemail.hu>
+
+       * include/gc.h pthread_support.c win32_threads.: Add 
+       GC_thread_is_registered API function.
+
 2005-02-17  Raja R Harinath  <rharinath@novell.com>
 
        * acinclude.m4: Don't include distributed libtool.m4.
index a60a6560d544c955c2e5431b647334a738784760..970c5b5b2b674f09928ebdb12a2dc94505f2cbd7 100644 (file)
@@ -827,6 +827,9 @@ GC_API GC_PTR GC_is_visible GC_PROTO((GC_PTR p));
 /* Always returns its argument.                                                */
 GC_API GC_PTR GC_is_valid_displacement GC_PROTO((GC_PTR        p));
 
+/* Returns 1 if the calling thread is registered with the GC, 0 otherwise */
+GC_API int GC_thread_is_registered GC_PROTO((void));
+
 /* Safer, but slow, pointer addition.  Probably useful mainly with     */
 /* a preprocessor.  Useful only for heap pointers.                     */
 #ifdef GC_DEBUG
index 5bb157f8b3fcb41ffa3a9d863cd2f598ee2f41c7..a1130ab2c88e4bda6901a34564cb2be6b98f46b6 100644 (file)
@@ -400,6 +400,17 @@ GC_PTR GC_local_gcj_malloc(size_t bytes,
 
 # endif /* !THREAD_LOCAL_ALLOC */
 
+int GC_thread_is_registered (void)
+{
+       void *ptr;
+
+       LOCK();
+       ptr = (void *)GC_lookup_thread(pthread_self());
+       UNLOCK();
+
+       return ptr ? 1 : 0;
+}
+
 #if 0
 /*
 To make sure that we're using LinuxThreads and not some other thread
index d2e97dee7d0b2cec1e1fca50fe6434ace6579daf..681e1c2b82e85b8652403a21c41589176bef3089 100644 (file)
@@ -72,6 +72,11 @@ volatile LONG GC_max_thread_index = 0; /* Largest index in thread_table      */
 
 extern LONG WINAPI GC_write_fault_handler(struct _EXCEPTION_POINTERS *exc_info);
 
+int GC_thread_is_registered (void)
+{
+       return 1;
+}
+
 /*
  * This may be called from DllMain, and hence operates under unusual
  * constraints.