[Mono-list] Thread.Suspend

tapia tapia@eitig.com
01 Feb 2003 17:25:39 +0000


Hi.

I'm coding a little app using System.Threading.Thread, and I've seen
that the Suspend() method is not implemented.

I'd like to contribute to Mono, and I think it's a good way, but I need
some help.

Well, that's what I did. Please, tell me what's wrong:

This goes in mcs/class/corlib/System.Threading/Thread.cs

--------------------------------------------

[MethodImplAttribute(MethodImplOptions.InternalCall)]
private extern void Suspend_internal();
                                                                                                                                  public void Suspend() {
   if((state & ThreadState.Unstarted) != 0 || !IsAlive) {
      throw new ThreadStateException("Thread has not been started, or is
dead");
   }
   set_state(ThreadState.SuspendRequested);
   Suspend_internal ();
}

--------------------------------------------

This is mono/mono/metadata/threads.c (just a test function):

--------------------------------------------

void ves_icall_System_Threading_Thread_Suspend_internal ()
{
        g_message("hello world!\n");
}

--------------------------------------------

This is mono/mono/metadata/threads.h:

--------------------------------------------

extern void ves_icall_System_Threading_Thread_Suspend_internal ();

--------------------------------------------

And this is mono/mono/metadata/icall.c, added to icall_map [] :

--------------------------------------------

"System.Threading.Thread::Suspend",
ves_icall_System_Threading_Thread_Suspend_internal,

--------------------------------------------

-- 
                 tapia@eitig.com|      c~~p ,---------.
cesar.garcia.tapia@hispalinux.es| ,---'oo  )           \
--------------------------------|( O O                  )/
         http://www.es.gnome.org| `=^='                 /
        http://mono.es.gnome.org|       \    ,     .   /
        http://www.hispalinux.es|       \\  |-----'|  /
            Debian GNU/Linux Sid|       ||__|    |_|__|