diff options
author | Paolo Molaro <lupus@oddwiz.org> | 2009-04-06 16:38:44 +0400 |
---|---|---|
committer | Paolo Molaro <lupus@oddwiz.org> | 2009-04-06 16:38:44 +0400 |
commit | 123970fb9ff1ee121350f3273b2fcb576f38dbb7 (patch) | |
tree | 1a805b6c35bbf326efd57d193c8ffa621dbac830 /mcs/class/Mono.Tasklets | |
parent | b3852bc8a5474198a0760fd619bb91e3f99ddef9 (diff) |
Mon Apr 6 14:37:32 CEST 2009 Paolo Molaro <lupus@ximian.com>
* Makefile, Mono.Tasklets: managed part of continuation support.
svn path=/trunk/mcs/; revision=131112
Diffstat (limited to 'mcs/class/Mono.Tasklets')
-rw-r--r-- | mcs/class/Mono.Tasklets/Assembly/AssemblyInfo.cs | 30 | ||||
-rw-r--r-- | mcs/class/Mono.Tasklets/Makefile | 9 | ||||
-rw-r--r-- | mcs/class/Mono.Tasklets/Mono.Tasklets.dll.sources | 4 | ||||
-rw-r--r-- | mcs/class/Mono.Tasklets/Mono.Tasklets/Continuation.cs | 91 |
4 files changed, 134 insertions, 0 deletions
diff --git a/mcs/class/Mono.Tasklets/Assembly/AssemblyInfo.cs b/mcs/class/Mono.Tasklets/Assembly/AssemblyInfo.cs new file mode 100644 index 00000000000..a461e90522f --- /dev/null +++ b/mcs/class/Mono.Tasklets/Assembly/AssemblyInfo.cs @@ -0,0 +1,30 @@ +// +// AssemblyInfo.cs +// +// Author: +// Andreas Nahr (ClassDevelopment@A-SoftTech.com) +// +// (C) 2003 Ximian, Inc. http://www.ximian.com +// (C) 2004 Novell (http://www.novell.com) +// + +using System; +using System.Reflection; +using System.Runtime.InteropServices; + +[assembly: AssemblyVersion (Consts.FxVersion)] + +/* TODO COMPLETE INFORMATION + +[assembly: AssemblyTitle ("")] +[assembly: AssemblyDescription ("")] + +[assembly: CLSCompliant (true)] +[assembly: AssemblyFileVersion ("0.0.0.1")] + +[assembly: ComVisible (false)] + +*/ + +[assembly: AssemblyDelaySign (true)] +[assembly: AssemblyKeyFile ("../mono.pub")] diff --git a/mcs/class/Mono.Tasklets/Makefile b/mcs/class/Mono.Tasklets/Makefile new file mode 100644 index 00000000000..8883dbaf834 --- /dev/null +++ b/mcs/class/Mono.Tasklets/Makefile @@ -0,0 +1,9 @@ +thisdir = class/Mono.Tasklets +SUBDIRS = +include ../../build/rules.make + +LIBRARY = Mono.Tasklets.dll +NO_TEST = yes + +include ../../build/library.make + diff --git a/mcs/class/Mono.Tasklets/Mono.Tasklets.dll.sources b/mcs/class/Mono.Tasklets/Mono.Tasklets.dll.sources new file mode 100644 index 00000000000..88cdfdc347c --- /dev/null +++ b/mcs/class/Mono.Tasklets/Mono.Tasklets.dll.sources @@ -0,0 +1,4 @@ +../../build/common/Consts.cs +../../build/common/Locale.cs +Assembly/AssemblyInfo.cs +Mono.Tasklets/Continuation.cs diff --git a/mcs/class/Mono.Tasklets/Mono.Tasklets/Continuation.cs b/mcs/class/Mono.Tasklets/Mono.Tasklets/Continuation.cs new file mode 100644 index 00000000000..006af5f0e0f --- /dev/null +++ b/mcs/class/Mono.Tasklets/Mono.Tasklets/Continuation.cs @@ -0,0 +1,91 @@ +// Author: Paolo Molaro <lupus@ximian.com> +// +// Copyright (C) 2009 Novell (http://www.novell.com) +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +using System; +using System.Runtime.CompilerServices; + +namespace Mono.Tasklets { + + // we may want to not expose this class at all in the API + // and just provide a higher-level API + public class Continuation + { + IntPtr cont; + + public Continuation () + { + cont = alloc (); + } + + ~Continuation () + { + if (cont != IntPtr.Zero) { + free (cont); + cont = IntPtr.Zero; + } + } + + [MethodImplAttribute (MethodImplOptions.InternalCall)] + extern static IntPtr alloc (); + + [MethodImplAttribute (MethodImplOptions.InternalCall)] + extern static void free (IntPtr cont); + + [MethodImplAttribute (MethodImplOptions.InternalCall)] + extern static Exception mark (IntPtr cont); + + [MethodImplAttribute (MethodImplOptions.InternalCall)] + extern static int store (IntPtr cont, int state, out Exception exception); + + [MethodImplAttribute (MethodImplOptions.InternalCall)] + extern static Exception restore (IntPtr cont, int state); + + [MethodImplAttribute (MethodImplOptions.NoInlining)] + public void Mark () + { + Exception e = mark (cont); + if (e != null) + throw e; + } + + public int Store (int state) + { + int rstate; + Exception e; + rstate = store (cont, state, out e); + if (e != null) + throw e; + return rstate; + } + + public void Restore (int state) + { + Exception e = restore (cont, state); + if (e != null) + throw e; + } + } + +} + |