Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/libgc
diff options
context:
space:
mode:
authorZoltan Varga <vargaz@gmail.com>2005-03-04 00:09:34 +0300
committerZoltan Varga <vargaz@gmail.com>2005-03-04 00:09:34 +0300
commit06ed27993a5a9e46895d8fcad43a5e8217fe5f58 (patch)
tree69e250a6b155b3052e91fef3309f67465016d1a4 /libgc
parent7838d80521615dc18d8cce38099102d15775f21a (diff)
2005-03-03 Zoltan Varga <vargaz@freemail.hu>
* include/gc.h pthread_support.c win32_threads.: Add GC_thread_is_registered API function. svn path=/trunk/mono/; revision=41410
Diffstat (limited to 'libgc')
-rw-r--r--libgc/ChangeLog5
-rw-r--r--libgc/include/gc.h3
-rw-r--r--libgc/pthread_support.c11
-rw-r--r--libgc/win32_threads.c5
4 files changed, 24 insertions, 0 deletions
diff --git a/libgc/ChangeLog b/libgc/ChangeLog
index f9ea2748d3f..22c5d88360a 100644
--- a/libgc/ChangeLog
+++ b/libgc/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.
diff --git a/libgc/include/gc.h b/libgc/include/gc.h
index a60a6560d54..970c5b5b2b6 100644
--- a/libgc/include/gc.h
+++ b/libgc/include/gc.h
@@ -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
diff --git a/libgc/pthread_support.c b/libgc/pthread_support.c
index b45341e2109..a33bd56350f 100644
--- a/libgc/pthread_support.c
+++ b/libgc/pthread_support.c
@@ -442,6 +442,17 @@ void * GC_local_gcj_fast_malloc(size_t lw, void * ptr_to_struct_containing_descr
# 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
diff --git a/libgc/win32_threads.c b/libgc/win32_threads.c
index d2e97dee7d0..681e1c2b82e 100644
--- a/libgc/win32_threads.c
+++ b/libgc/win32_threads.c
@@ -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.