dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[dotgnu-pnet-commits] pnet ChangeLog include/il_gc.h support/def_gc.c...


From: Klaus Treichel
Subject: [dotgnu-pnet-commits] pnet ChangeLog include/il_gc.h support/def_gc.c...
Date: Tue, 29 Jul 2008 17:35:13 +0000

CVSROOT:        /cvsroot/dotgnu-pnet
Module name:    pnet
Changes by:     Klaus Treichel <ktreichel>      08/07/29 17:35:13

Modified files:
        .              : ChangeLog 
        include        : il_gc.h 
        support        : def_gc.c hb_gc.c thread.c 

Log message:
        Clean up some code.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pnet/ChangeLog?cvsroot=dotgnu-pnet&r1=1.3546&r2=1.3547
http://cvs.savannah.gnu.org/viewcvs/pnet/include/il_gc.h?cvsroot=dotgnu-pnet&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/pnet/support/def_gc.c?cvsroot=dotgnu-pnet&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/pnet/support/hb_gc.c?cvsroot=dotgnu-pnet&r1=1.27&r2=1.28
http://cvs.savannah.gnu.org/viewcvs/pnet/support/thread.c?cvsroot=dotgnu-pnet&r1=1.33&r2=1.34

Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/ChangeLog,v
retrieving revision 1.3546
retrieving revision 1.3547
diff -u -b -r1.3546 -r1.3547
--- ChangeLog   20 Jul 2008 12:25:39 -0000      1.3546
+++ ChangeLog   29 Jul 2008 17:35:12 -0000      1.3547
@@ -1,3 +1,15 @@
+2008-07-29  Klaus Treichel  <address@hidden>
+
+       * include/il_gc.h (ILGCRunFunc): Add prototype for the function that
+       allows running a function under GC control by a thread not created
+       by the GC functions.
+
+       * support/def_gc.c, support/hb_gc.c (ILGCRunFunc): Implement the
+       function.
+
+       * support/thread.c (ILThreadRunSelf): Use ILGCRunFunc instead of calling
+       libgc functions directly.
+
 2008-07-20  Klaus Treichel  <address@hidden>
 
        * codegen/cg_relop.tc: Change the code generation for float compares.

Index: include/il_gc.h
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/include/il_gc.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- include/il_gc.h     13 Jun 2004 07:21:05 -0000      1.9
+++ include/il_gc.h     29 Jul 2008 17:35:12 -0000      1.10
@@ -140,6 +140,18 @@
  */
 void *ILGCAllocExplicitlyTyped(unsigned long size, ILNativeInt descriptor);
 
+/*
+ * Run a function under control of the garbage collector.
+ * Thie function is intended to be used by threads not created through
+ * the gc thread routines like a callback with a thread created by a
+ * third party library.
+ * The return value must not be an object under gc control because the
+ * stack of this thread will not be scanned after returning from this
+ * function and the memory of this object is likely to be reclaimed by
+ * the garbage collector.
+ */
+void *ILGCRunFunc(void *(* thread_func)(void *), void *arg);
+
 #ifdef __cplusplus
 };
 #endif

Index: support/def_gc.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/support/def_gc.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- support/def_gc.c    13 Jun 2004 07:21:05 -0000      1.9
+++ support/def_gc.c    29 Jul 2008 17:35:13 -0000      1.10
@@ -223,6 +223,11 @@
        /* Nothing to do here because we don't do finalization */
 }
 
+void *ILGCRunFunc(void *(* thread_func)(void *), void *arg)
+{
+       return thread_func(arg);
+}
+
 #ifdef __cplusplus
 };
 #endif

Index: support/hb_gc.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/support/hb_gc.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -b -r1.27 -r1.28
--- support/hb_gc.c     6 Nov 2005 17:35:31 -0000       1.27
+++ support/hb_gc.c     29 Jul 2008 17:35:13 -0000      1.28
@@ -466,6 +466,11 @@
        GC_general_register_disappearing_link(ptr, obj);
 }
 
+void *ILGCRunFunc(void *(* thread_func)(void *), void *arg)
+{
+       return GC_run_thread(thread_func, arg);
+}
+
 #ifdef __cplusplus
 };
 #endif

Index: support/thread.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/support/thread.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -b -r1.33 -r1.34
--- support/thread.c    12 Oct 2007 15:07:09 -0000      1.33
+++ support/thread.c    29 Jul 2008 17:35:13 -0000      1.34
@@ -285,11 +285,7 @@
        /* Set the thread object for the thread */
        _ILThreadSetSelf(thread_self);
 
-       #ifdef HAVE_LIBGC
-               result = GC_run_thread(thread_func, arg);
-       #else
-               result = thread_func(arg);
-       #endif
+       result = ILGCRunFunc(thread_func, arg);
 
        _ILThreadRunAndFreeCleanups(thread_self);
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]