Example #1
0
        internal static void Init(NetRuby rb)
        {
            rb.eThreadError = rb.DefineClass("ThreadError", rb.eException);

            RThreadClass t = new RThreadClass(rb);

            t.DefineClass("Thread", rb.cObject);
            rb.cThread = t;
            t.DefineSingletonMethod("new", new RMethod(thread_new), -1);
            t.DefineMethod("initialize", new RMethod(initialize), -2);
            t.DefineSingletonMethod("start", new RMethod(thread_start), -2);
            t.DefineSingletonMethod("fork", new RMethod(thread_start), -2);
            t.DefineSingletonMethod("stop", new RMethod(thread_stop), 0);
            t.DefineSingletonMethod("kill", new RMethod(thread_s_kill), 1);
            t.DefineSingletonMethod("exit", new RMethod(thread_exit), 0);
            t.DefineSingletonMethod("pass", new RMethod(thread_pass), 0);
            t.DefineSingletonMethod("current", new RMethod(thread_current), 0);
            t.DefineSingletonMethod("main", new RMethod(thread_main), 0);
            t.DefineSingletonMethod("list", new RMethod(thread_list), 0);

            t.DefineSingletonMethod("critical", new RMethod(critical_getset), 0);
            t.DefineSingletonMethod("critical", new RMethod(critical_getset), 1);
            t.DefineSingletonMethod("abort_on_exception", new RMethod(thread_s_abort_exc), 0);
            t.DefineSingletonMethod("abort_on_exception=", new RMethod(thread_s_abort_set), 1);

            t.DefineMethod("run", new RMethod(thread_run), 0);
            t.DefineMethod("wakeup", new RMethod(thread_wakeup), 0);
            t.DefineMethod("kill", new RMethod(thread_kill), 0);
            t.DefineMethod("exit", new RMethod(thread_kill), 0);
            t.DefineMethod("value", new RMethod(thread_value), 0);
            t.DefineMethod("status", new RMethod(thread_status), 0);
            t.DefineMethod("join", new RMethod(thread_join), 0);
            t.DefineMethod("alive?", new RMethod(thread_alive), 0);
            t.DefineMethod("stop?", new RMethod(thread_isstop), 0);
            t.DefineMethod("raise", new RMethod(thread_raise), 0);

            t.DefineMethod("abort_on_exception", new RMethod(thread_abort_exc), 0);
            t.DefineMethod("abort_on_exception=", new RMethod(thread_abort_set), 1);

            t.DefineMethod("priority", new RMethod(thread_priority), 0);
            t.DefineMethod("priority=", new RMethod(thread_priority_set), 1);
            ////t.DefineMethod("safe_level", new RMethod(thread_safe_level), 0);

            t.DefineMethod("[]", new RMethod(thread_aref), 1);
            t.DefineMethod("[]=", new RMethod(thread_aset), 2);
            t.DefineMethod("key?", new RMethod(thread_keyp), 1);
        }
Example #2
0
        internal static void Init(NetRuby rb)
        {
            rb.eThreadError = rb.DefineClass("ThreadError", rb.eException);
        
            RThreadClass t = new RThreadClass(rb);
            t.DefineClass("Thread", rb.cObject);
            rb.cThread = t;
            t.DefineSingletonMethod("new", new RMethod(thread_new), -1);
            t.DefineMethod("initialize", new RMethod(initialize), -2);
            t.DefineSingletonMethod("start", new RMethod(thread_start), -2);
            t.DefineSingletonMethod("fork", new RMethod(thread_start), -2);
            t.DefineSingletonMethod("stop", new RMethod(thread_stop), 0);
            t.DefineSingletonMethod("kill", new RMethod(thread_s_kill), 1);
            t.DefineSingletonMethod("exit", new RMethod(thread_exit), 0);
            t.DefineSingletonMethod("pass", new RMethod(thread_pass), 0);
            t.DefineSingletonMethod("current", new RMethod(thread_current), 0);
            t.DefineSingletonMethod("main", new RMethod(thread_main), 0);
            t.DefineSingletonMethod("list", new RMethod(thread_list), 0);

            t.DefineSingletonMethod("critical", new RMethod(critical_getset), 0);
            t.DefineSingletonMethod("critical", new RMethod(critical_getset), 1);
            t.DefineSingletonMethod("abort_on_exception", new RMethod(thread_s_abort_exc), 0);
            t.DefineSingletonMethod("abort_on_exception=", new RMethod(thread_s_abort_set), 1);
        
            t.DefineMethod("run", new RMethod(thread_run), 0);
            t.DefineMethod("wakeup", new RMethod(thread_wakeup), 0);
            t.DefineMethod("kill", new RMethod(thread_kill), 0);
            t.DefineMethod("exit", new RMethod(thread_kill), 0);
            t.DefineMethod("value", new RMethod(thread_value), 0);
            t.DefineMethod("status", new RMethod(thread_status), 0);
            t.DefineMethod("join", new RMethod(thread_join), 0);
            t.DefineMethod("alive?", new RMethod(thread_alive), 0);
            t.DefineMethod("stop?", new RMethod(thread_isstop), 0);
            t.DefineMethod("raise", new RMethod(thread_raise), 0);

            t.DefineMethod("abort_on_exception", new RMethod(thread_abort_exc), 0);
            t.DefineMethod("abort_on_exception=", new RMethod(thread_abort_set), 1);

            t.DefineMethod("priority", new RMethod(thread_priority), 0);
            t.DefineMethod("priority=", new RMethod(thread_priority_set), 1);
            ////t.DefineMethod("safe_level", new RMethod(thread_safe_level), 0);
        
            t.DefineMethod("[]", new RMethod(thread_aref), 1);
            t.DefineMethod("[]=", new RMethod(thread_aset), 2);
            t.DefineMethod("key?", new RMethod(thread_keyp), 1);
        }