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

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

[dotgnu-pnet-commits] pnet ChangeLog engine/int_proto.h engine/int_ta...


From: Radek Polak
Subject: [dotgnu-pnet-commits] pnet ChangeLog engine/int_proto.h engine/int_ta...
Date: Fri, 12 Oct 2007 15:07:09 +0000

CVSROOT:        /sources/dotgnu-pnet
Module name:    pnet
Changes by:     Radek Polak <radekp>    07/10/12 15:07:09

Modified files:
        .              : ChangeLog 
        engine         : int_proto.h int_table.c lib_thread.c process.c 
        include        : il_thread.h 
        support        : pt_defs.c thread.c 

Log message:
        functions for sending abort signal needed for fixing bug #20885

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pnet/ChangeLog?cvsroot=dotgnu-pnet&r1=1.3505&r2=1.3506
http://cvs.savannah.gnu.org/viewcvs/pnet/engine/int_proto.h?cvsroot=dotgnu-pnet&r1=1.103&r2=1.104
http://cvs.savannah.gnu.org/viewcvs/pnet/engine/int_table.c?cvsroot=dotgnu-pnet&r1=1.107&r2=1.108
http://cvs.savannah.gnu.org/viewcvs/pnet/engine/lib_thread.c?cvsroot=dotgnu-pnet&r1=1.37&r2=1.38
http://cvs.savannah.gnu.org/viewcvs/pnet/engine/process.c?cvsroot=dotgnu-pnet&r1=1.73&r2=1.74
http://cvs.savannah.gnu.org/viewcvs/pnet/include/il_thread.h?cvsroot=dotgnu-pnet&r1=1.28&r2=1.29
http://cvs.savannah.gnu.org/viewcvs/pnet/support/pt_defs.c?cvsroot=dotgnu-pnet&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/pnet/support/thread.c?cvsroot=dotgnu-pnet&r1=1.32&r2=1.33

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/dotgnu-pnet/pnet/ChangeLog,v
retrieving revision 1.3505
retrieving revision 1.3506
diff -u -b -r1.3505 -r1.3506
--- ChangeLog   11 Oct 2007 19:31:51 -0000      1.3505
+++ ChangeLog   12 Oct 2007 15:07:08 -0000      1.3506
@@ -1,3 +1,15 @@
+2007-10-12  Radek Polak  <address@hidden>
+
+       * engine/int_proto.h, engine/int_table.c, engine/lib_thread.c,
+       include/il_thread.h, support/pt_defs.c, support/thread.c: Implement
+       functions that allow sending IL_SIG_ABORT signal. This is used to
+       cancel blocking operations (bug #20885).
+
+       * engine/process.c: Send abort signal on background threads, when
+       process is ending so that background threads do not prevent program to
+       exit.
+       
+
 2007-10-11  Klaus Treichel  <address@hidden>
 
        * image/generic_class.c: Fix a warning by casting the event to an

Index: engine/int_proto.h
===================================================================
RCS file: /sources/dotgnu-pnet/pnet/engine/int_proto.h,v
retrieving revision 1.103
retrieving revision 1.104
diff -u -b -r1.103 -r1.104
--- engine/int_proto.h  9 Oct 2007 12:25:49 -0000       1.103
+++ engine/int_proto.h  12 Oct 2007 15:07:08 -0000      1.104
@@ -706,6 +706,8 @@
 extern ILObject * _IL_SocketMethods_CreateManualResetEvent(ILExecThread * 
_thread);
 extern void _IL_SocketMethods_WaitHandleSet(ILExecThread * _thread, ILObject * 
waitHandle);
 
+extern void _IL_BlockingOperation_ThreadSigAbort(ILExecThread * _thread, 
ILObject * thread);
+
 extern ILInt32 _IL_IPAddress_HostToNetworkOrder_i(ILExecThread * _thread, 
ILInt32 host);
 extern ILInt32 _IL_IPAddress_NetworkToHostOrder_i(ILExecThread * _thread, 
ILInt32 network);
 extern ILInt64 _IL_IPAddress_HostToNetworkOrder_l(ILExecThread * _thread, 
ILInt64 host);

Index: engine/int_table.c
===================================================================
RCS file: /sources/dotgnu-pnet/pnet/engine/int_table.c,v
retrieving revision 1.107
retrieving revision 1.108
diff -u -b -r1.107 -r1.108
--- engine/int_table.c  9 Oct 2007 12:25:49 -0000       1.107
+++ engine/int_table.c  12 Oct 2007 15:07:08 -0000      1.108
@@ -3064,6 +3064,14 @@
 
 #endif
 
+#ifndef _IL_BlockingOperation_suppressed
+
+IL_METHOD_BEGIN(BlockingOperation_Methods)
+       IL_METHOD("ThreadSigAbort", "(oSystem.Threading.Thread;)V", 
_IL_BlockingOperation_ThreadSigAbort, marshal_vpp)
+IL_METHOD_END
+
+#endif
+
 #if !defined(HAVE_LIBFFI)
 
 static void marshal_lpl(void (*fn)(), void *rvalue, void **avalue)
@@ -3149,6 +3157,9 @@
 #ifndef _IL_BitConverter_suppressed
        {"BitConverter", "System", BitConverter_Methods},
 #endif
+#ifndef _IL_BlockingOperation_suppressed
+       {"BlockingOperation", "System.Private", BlockingOperation_Methods},
+#endif
 #ifndef _IL_Buffer_suppressed
        {"Buffer", "System", Buffer_Methods},
 #endif

Index: engine/lib_thread.c
===================================================================
RCS file: /sources/dotgnu-pnet/pnet/engine/lib_thread.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -b -r1.37 -r1.38
--- engine/lib_thread.c 17 Dec 2006 10:31:32 -0000      1.37
+++ engine/lib_thread.c 12 Oct 2007 15:07:09 -0000      1.38
@@ -1123,6 +1123,14 @@
        return (ILBool)ILWaitEventSet((ILWaitHandle *)event);
 }
 
+/*
+ * static void BlockingOperation.ThreadSigAbort(Thread thread);
+ */
+void _IL_BlockingOperation_ThreadSigAbort(ILExecThread * _thread, ILObject * 
thread)
+{
+       ILThreadSigAbort(((System_Thread *)thread)->privateData);
+}
+
 #ifdef __cplusplus
 };
 #endif

Index: engine/process.c
===================================================================
RCS file: /sources/dotgnu-pnet/pnet/engine/process.c,v
retrieving revision 1.73
retrieving revision 1.74
diff -u -b -r1.73 -r1.74
--- engine/process.c    17 Mar 2007 19:11:37 -0000      1.73
+++ engine/process.c    12 Oct 2007 15:07:09 -0000      1.74
@@ -381,6 +381,12 @@
        {
                target = (ILThread *)ILQueueRemove(&abortQueue1);
 
+               /* Cancel possible blocking in kernel call on background 
threads */
+               if(ILThreadGetBackground(target))
+               {
+                       ILThreadSigAbort(target);
+               }
+
                _ILExecThreadAbortThread(ILExecThreadCurrent(), target);
        }
 

Index: include/il_thread.h
===================================================================
RCS file: /sources/dotgnu-pnet/pnet/include/il_thread.h,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -b -r1.28 -r1.29
--- include/il_thread.h 11 Feb 2007 14:34:32 -0000      1.28
+++ include/il_thread.h 12 Oct 2007 15:07:09 -0000      1.29
@@ -191,6 +191,12 @@
 void ILThreadInterrupt(ILThread *thread);
 
 /*
+ * Send IL_SIG_ABORT to given thread. This will abort thread that
+ * is blocking in system call.
+ */
+void ILThreadSigAbort(ILThread *thread);
+
+/*
  * Request that a thread be aborted.  Returns zero if the thread
  * is already aborting or already has an abort request queued.
  */

Index: support/pt_defs.c
===================================================================
RCS file: /sources/dotgnu-pnet/pnet/support/pt_defs.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- support/pt_defs.c   11 Feb 2007 14:34:32 -0000      1.10
+++ support/pt_defs.c   12 Oct 2007 15:07:09 -0000      1.11
@@ -147,18 +147,22 @@
 
        /* Set up the signal handlers that we require */
        ILMemZero(&action, sizeof(action));
-       action.sa_flags = SA_RESTART;
        sigfillset(&(action.sa_mask));
        sigdelset(&(action.sa_mask), SIGINT);
        sigdelset(&(action.sa_mask), SIGQUIT);
        sigdelset(&(action.sa_mask), SIGTERM);
        sigdelset(&(action.sa_mask), SIGABRT);
+
+       /* Abort signal - used to stop blocking IO,
+          SA_RESTART must not be set */
+       action.sa_handler = AbortSignal;
+       sigaction(IL_SIG_ABORT, &action, (struct sigaction *)0);
+
+       action.sa_flags = SA_RESTART;
        action.sa_handler = SuspendSignal;
        sigaction(IL_SIG_SUSPEND, &action, (struct sigaction *)0);
        action.sa_handler = ResumeSignal;
        sigaction(IL_SIG_RESUME, &action, (struct sigaction *)0);
-       action.sa_handler = AbortSignal;
-       sigaction(IL_SIG_ABORT, &action, (struct sigaction *)0);
 
        /* We need a thread-specific key for storing thread objects */
        pthread_key_create(&_ILThreadObjectKey, (void (*)(void *))0);

Index: support/thread.c
===================================================================
RCS file: /sources/dotgnu-pnet/pnet/support/thread.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -b -r1.32 -r1.33
--- support/thread.c    6 Nov 2005 17:35:31 -0000       1.32
+++ support/thread.c    12 Oct 2007 15:07:09 -0000      1.33
@@ -639,6 +639,13 @@
        return result;
 }
 
+void ILThreadSigAbort(ILThread *thread)
+{
+#ifdef IL_USE_PTHREADS
+       pthread_kill(thread->handle, IL_SIG_ABORT);
+#endif
+}
+
 int ILThreadAbort(ILThread *thread)
 {
        int result;




reply via email to

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