[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[dotgnu-pnet-commits] pnetlib ChangeLog DotGNU.Misc/BlockingOperation...
From: |
Radek Polak |
Subject: |
[dotgnu-pnet-commits] pnetlib ChangeLog DotGNU.Misc/BlockingOperation... |
Date: |
Tue, 25 Nov 2008 09:09:45 +0000 |
CVSROOT: /sources/dotgnu-pnet
Module name: pnetlib
Changes by: Radek Polak <radekp> 08/11/25 09:09:45
Modified files:
. : ChangeLog
DotGNU.Misc : BlockingOperation.cs
System/Net/Sockets: Socket.cs
Added files:
runtime/DotGNU/Platform: BlockingOperation.cs
BlockingOperations.cs
Removed files:
System/Private : BlockingOperation.cs BlockingOperations.cs
Log message:
moved blocking operations to runtime
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pnetlib/ChangeLog?cvsroot=dotgnu-pnet&r1=1.2544&r2=1.2545
http://cvs.savannah.gnu.org/viewcvs/pnetlib/DotGNU.Misc/BlockingOperation.cs?cvsroot=dotgnu-pnet&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/pnetlib/System/Net/Sockets/Socket.cs?cvsroot=dotgnu-pnet&r1=1.26&r2=1.27
http://cvs.savannah.gnu.org/viewcvs/pnetlib/System/Private/BlockingOperation.cs?cvsroot=dotgnu-pnet&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/pnetlib/System/Private/BlockingOperations.cs?cvsroot=dotgnu-pnet&r1=1.1&r2=0
http://cvs.savannah.gnu.org/viewcvs/pnetlib/runtime/DotGNU/Platform/BlockingOperation.cs?cvsroot=dotgnu-pnet&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/pnetlib/runtime/DotGNU/Platform/BlockingOperations.cs?cvsroot=dotgnu-pnet&rev=1.1
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/dotgnu-pnet/pnetlib/ChangeLog,v
retrieving revision 1.2544
retrieving revision 1.2545
diff -u -b -r1.2544 -r1.2545
--- ChangeLog 5 Oct 2008 20:29:47 -0000 1.2544
+++ ChangeLog 25 Nov 2008 09:09:44 -0000 1.2545
@@ -1,3 +1,17 @@
+2008-11-25 Radek Polak <address@hidden>
+
+ * System/Private/BlockingOperation.cs,
+ System/Private/BlockingOperations.cs: Moved to runtime.
+
+ * runtime/DotGNU/Platform/BlockingOperation.cs,
+ runtime/DotGNU/Platform/BlockingOperations.cs: Moved here from
+ System and make the functions public.
+
+ * DotGNU.Misc/BlockingOperation.cs: Using functions from runtime
+ instead of internal call.
+
+ * System/Net/Sockets/Socket.cs: Use blocking ops in runtime.
+
2008-10-05 Klaus Treichel <address@hidden>
* runtime/System/Nullable.cs, runtime/System/Nullable_1.cs: Add support
Index: DotGNU.Misc/BlockingOperation.cs
===================================================================
RCS file: /sources/dotgnu-pnet/pnetlib/DotGNU.Misc/BlockingOperation.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- DotGNU.Misc/BlockingOperation.cs 12 Oct 2007 15:10:55 -0000 1.1
+++ DotGNU.Misc/BlockingOperation.cs 25 Nov 2008 09:09:44 -0000 1.2
@@ -29,8 +29,10 @@
{
// Send IL_SIG_ABORT to given thread to cancel operation that is
blocking
// in system call.
- [MethodImpl(MethodImplOptions.InternalCall)]
- extern public static void ThreadSigAbort(Thread thread);
+ public static void ThreadSigAbort(Thread thread)
+ {
+
DotGNU.Platform.BlockingOperation.ThreadSigAbort(thread);
+ }
}; // class BlockingOperation
Index: System/Net/Sockets/Socket.cs
===================================================================
RCS file: /sources/dotgnu-pnet/pnetlib/System/Net/Sockets/Socket.cs,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -b -r1.26 -r1.27
--- System/Net/Sockets/Socket.cs 22 Oct 2007 08:14:08 -0000 1.26
+++ System/Net/Sockets/Socket.cs 25 Nov 2008 09:09:44 -0000 1.27
@@ -22,6 +22,7 @@
{
using Platform;
+using DotGNU.Platform;
using System;
using System.Private;
using System.Collections;
Index: runtime/DotGNU/Platform/BlockingOperation.cs
===================================================================
RCS file: runtime/DotGNU/Platform/BlockingOperation.cs
diff -N runtime/DotGNU/Platform/BlockingOperation.cs
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ runtime/DotGNU/Platform/BlockingOperation.cs 25 Nov 2008 09:09:45
-0000 1.1
@@ -0,0 +1,84 @@
+/*
+ * BlockingOperation.cs - Helper class for aborting blocking operation.
+ *
+ * Copyright (C) 2007 Southern Storm Software, Pty Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+namespace DotGNU.Platform
+{
+
+using System;
+using System.Threading;
+using System.Runtime.CompilerServices;
+
+// Helper that must be disposed after blocking operation ends.
+public sealed class BlockingOperation : IDisposable
+{
+ // Internal state.
+ private Thread thread;
+ private BlockingOperation next;
+
+ // Constructor.
+ public BlockingOperation(Thread thread)
+ {
+ this.thread = thread;
+ }
+
+ public Thread Thread
+ {
+ get
+ {
+ return thread;
+ }
+ set
+ {
+ thread = value;
+ }
+ }
+
+ public BlockingOperation Next
+ {
+ get
+ {
+ return next;
+ }
+ set
+ {
+ next = value;
+ }
+ }
+
+ // Send IL_SIG_ABORT to given thread to cancel operation that is
blocking
+ // in system call.
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ extern public static void ThreadSigAbort(Thread thread);
+
+ // Handle leave from blocking operation.
+ public void Dispose()
+ {
+ thread = null;
+ }
+
+ public void Abort()
+ {
+ ThreadSigAbort(thread);
+ thread = null;
+ }
+
+}; // class BlockingOperation
+
+}; // namespace DotGNU.Platform
Index: runtime/DotGNU/Platform/BlockingOperations.cs
===================================================================
RCS file: runtime/DotGNU/Platform/BlockingOperations.cs
diff -N runtime/DotGNU/Platform/BlockingOperations.cs
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ runtime/DotGNU/Platform/BlockingOperations.cs 25 Nov 2008 09:09:45
-0000 1.1
@@ -0,0 +1,104 @@
+/*
+ * BlockingOperations.cs - Class used to abort blocking operations on unixes.
+ *
+ * Copyright (C) 2007 Southern Storm Software, Pty Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+namespace DotGNU.Platform
+{
+
+using System;
+using System.Threading;
+using Platform;
+
+// On unix when thread enters blocking system call (e.g. socket accept), it
+// cant be regulary aborted from managed code. On windows you can unblock the
+// thread by closing socket's handle.
+//
+// This class is used to emulate the windows behavior by sending abort signal
+// when socket is closed.
+//
+// This class holds references to threads that are blocked in kernel calls.
+// Call NewOp() before you start blocking operation and dispose returned result
+// when blocking operation ends. For example:
+//
+// using(BlockingOperation op = blockingOps.NewOp())
+// {
+// some_blocking_operation_e_g_socket.accept();
+// }
+//
+// After you close resource of blocking operation (socket), you can call
+// Abort() to unblock all registered operations that are blocking.
+public sealed class BlockingOperations
+{
+ // Internal state.
+ private BlockingOperation operations;
+
+ // Constructor.
+ public BlockingOperations()
+ {
+ }
+
+ // Call this method before starting blocking operation.
+ // Dispose result after operation is done.
+ public BlockingOperation NewOp()
+ {
+ lock(this)
+ {
+ // Try to find free handler
+ BlockingOperation o = operations;
+ while(o != null)
+ {
+ if(o.Thread == null)
+ {
+ o.Thread =
Thread.CurrentThread;
+ return o;
+ }
+ else
+ {
+ o = o.Next;
+ }
+ }
+
+ // Create new handler and append other
handlers
+ o = operations;
+ operations = new
BlockingOperation(Thread.CurrentThread);
+ operations.Next = o;
+ return operations;
+ }
+ }
+
+ // Abort all blocking operations.
+ public void Abort()
+ {
+ lock(this)
+ {
+ BlockingOperation o = operations;
+ while(o != null)
+ {
+ if(o.Thread != null)
+ {
+ o.Abort();
+ }
+ o = o.Next;
+ }
+ }
+ }
+
+}; // class BlockingOperations
+
+}; // namespace DotGNU.Platform
Index: System/Private/BlockingOperation.cs
===================================================================
RCS file: System/Private/BlockingOperation.cs
diff -N System/Private/BlockingOperation.cs
--- System/Private/BlockingOperation.cs 12 Oct 2007 15:10:55 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,84 +0,0 @@
-/*
- * BlockingOperation.cs - Helper class for aborting blocking operation.
- *
- * Copyright (C) 2007 Southern Storm Software, Pty Ltd.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-namespace System.Private
-{
-
-using System;
-using System.Threading;
-using System.Runtime.CompilerServices;
-
-// Helper that must be disposed after blocking operation ends.
-internal sealed class BlockingOperation : IDisposable
-{
- // Internal state.
- private Thread thread;
- private BlockingOperation next;
-
- // Constructor.
- public BlockingOperation(Thread thread)
- {
- this.thread = thread;
- }
-
- public Thread Thread
- {
- get
- {
- return thread;
- }
- set
- {
- thread = value;
- }
- }
-
- public BlockingOperation Next
- {
- get
- {
- return next;
- }
- set
- {
- next = value;
- }
- }
-
- // Send IL_SIG_ABORT to given thread to cancel operation that is
blocking
- // in system call.
- [MethodImpl(MethodImplOptions.InternalCall)]
- extern public static void ThreadSigAbort(Thread thread);
-
- // Handle leave from blocking operation.
- public void Dispose()
- {
- thread = null;
- }
-
- public void Abort()
- {
- ThreadSigAbort(thread);
- thread = null;
- }
-
-}; // class BlockingOperation
-
-}; // namespace System.Private
Index: System/Private/BlockingOperations.cs
===================================================================
RCS file: System/Private/BlockingOperations.cs
diff -N System/Private/BlockingOperations.cs
--- System/Private/BlockingOperations.cs 12 Oct 2007 15:10:55 -0000
1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,104 +0,0 @@
-/*
- * BlockingOperations.cs - Class used to abort blocking operations on unixes.
- *
- * Copyright (C) 2007 Southern Storm Software, Pty Ltd.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-namespace System.Private
-{
-
-using System;
-using System.Threading;
-using Platform;
-
-// On unix when thread enters blocking system call (e.g. socket accept), it
-// cant be regulary aborted from managed code. On windows you can unblock the
-// thread by closing socket's handle.
-//
-// This class is used to emulate the windows behavior by sending abort signal
-// when socket is closed.
-//
-// This class holds references to threads that are blocked in kernel calls.
-// Call NewOp() before you start blocking operation and dispose returned result
-// when blocking operation ends. For example:
-//
-// using(BlockingOperation op = blockingOps.NewOp())
-// {
-// some_blocking_operation_e_g_socket.accept();
-// }
-//
-// After you close resource of blocking operation (socket), you can call
-// Abort() to unblock all registered operations that are blocking.
-internal sealed class BlockingOperations
-{
- // Internal state.
- private BlockingOperation operations;
-
- // Constructor.
- public BlockingOperations()
- {
- }
-
- // Call this method before starting blocking operation.
- // Dispose result after operation is done.
- public BlockingOperation NewOp()
- {
- lock(this)
- {
- // Try to find free handler
- BlockingOperation o = operations;
- while(o != null)
- {
- if(o.Thread == null)
- {
- o.Thread =
Thread.CurrentThread;
- return o;
- }
- else
- {
- o = o.Next;
- }
- }
-
- // Create new handler and append other
handlers
- o = operations;
- operations = new
BlockingOperation(Thread.CurrentThread);
- operations.Next = o;
- return operations;
- }
- }
-
- // Abort all blocking operations.
- public void Abort()
- {
- lock(this)
- {
- BlockingOperation o = operations;
- while(o != null)
- {
- if(o.Thread != null)
- {
- o.Abort();
- }
- o = o.Next;
- }
- }
- }
-
-}; // class BlockingOperations
-
-}; // namespace System.Private
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [dotgnu-pnet-commits] pnetlib ChangeLog DotGNU.Misc/BlockingOperation...,
Radek Polak <=