* include/gc.h pthread_support.c win32_threads.: Add
GC_thread_is_registered API function.
svn path=/trunk/mono/; revision=41410
+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.
/* 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
# 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
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.