[svn:parrot] r46168 - in trunk: include/parrot src

tewk at svn.parrot.org tewk at svn.parrot.org
Fri Apr 30 03:48:28 UTC 2010


Author: tewk
Date: Fri Apr 30 03:48:28 2010
New Revision: 46168
URL: https://trac.parrot.org/parrot/changeset/46168

Log:
Remove pt_thread_run

Modified:
   trunk/include/parrot/thread.h
   trunk/src/thread.c

Modified: trunk/include/parrot/thread.h
==============================================================================
--- trunk/include/parrot/thread.h	Fri Apr 30 03:48:21 2010	(r46167)
+++ trunk/include/parrot/thread.h	Fri Apr 30 03:48:28 2010	(r46168)
@@ -201,14 +201,6 @@
 
 void pt_thread_kill(UINTVAL tid);
 void pt_thread_prepare_for_run(Parrot_Interp d, NULLOK(Parrot_Interp s));
-int pt_thread_run(PARROT_INTERP,
-    ARGOUT(PMC *dest_interp),
-    ARGIN(PMC *sub),
-    ARGIN_NULLOK(PMC *arg))
-        __attribute__nonnull__(1)
-        __attribute__nonnull__(2)
-        __attribute__nonnull__(3)
-        FUNC_MODIFIES(*dest_interp);
 
 void pt_thread_wait_with(PARROT_INTERP, ARGMOD(Parrot_mutex *mutex))
         __attribute__nonnull__(1)
@@ -254,10 +246,6 @@
        PARROT_ASSERT_ARG(parent))
 #define ASSERT_ARGS_pt_thread_kill __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
 #define ASSERT_ARGS_pt_thread_prepare_for_run __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
-#define ASSERT_ARGS_pt_thread_run __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(interp) \
-    , PARROT_ASSERT_ARG(dest_interp) \
-    , PARROT_ASSERT_ARG(sub))
 #define ASSERT_ARGS_pt_thread_wait_with __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \
     , PARROT_ASSERT_ARG(mutex))

Modified: trunk/src/thread.c
==============================================================================
--- trunk/src/thread.c	Fri Apr 30 03:48:21 2010	(r46167)
+++ trunk/src/thread.c	Fri Apr 30 03:48:28 2010	(r46168)
@@ -705,94 +705,6 @@
 
 /*
 
-=item C<int pt_thread_run(PARROT_INTERP, PMC *dest_interp, PMC *sub, PMC *arg)>
-
-Runs the C<*sub> PMC in a separate thread using the interpreter in
-C<*dest_interp>.
-
-C<arg> should be an array of arguments for the subroutine.
-
-=cut
-
-*/
-
-int
-pt_thread_run(PARROT_INTERP, ARGOUT(PMC *dest_interp), ARGIN(PMC *sub), ARGIN_NULLOK(PMC *arg))
-{
-    ASSERT_ARGS(pt_thread_run)
-    PMC *old_dest_interp;
-    PMC *parent;
-    Interp * const interpreter = (Parrot_Interp)VTABLE_get_pointer(interp,
-            dest_interp);
-
-    Parrot_block_GC_sweep(interpreter);
-    Parrot_block_GC_mark(interpreter);
-    Parrot_block_GC_sweep(interp);
-    Parrot_block_GC_mark(interp);
-
-    /* make a copy of the ParrotThread PMC so we can use it
-     * to hold parameters to the new thread without it being
-     * garbage collected or otherwise changed by the parent thread.
-     * Also so the new thread's getinterp doesn't return an object
-     * owned by the wrong interpreter -- which would be very bad
-     * if the parent is destroyed before the child.
-     * XXX FIXME move this elsewhere? at least the set_pmc_keyed_int
-     */
-    old_dest_interp = dest_interp;
-    dest_interp     = Parrot_pmc_new_noinit(interpreter, enum_class_ParrotThread);
-
-    /* so it's not accidentally deleted */
-    VTABLE_set_pointer(interp, old_dest_interp, NULL);
-    VTABLE_set_pointer(interp, dest_interp, interpreter);
-
-    VTABLE_set_pmc_keyed_int(interpreter, interpreter->iglobals,
-        (INTVAL) IGLOBALS_INTERPRETER, dest_interp);
-
-    parent = VTABLE_get_pmc_keyed_int(interp, interp->iglobals,
-                IGLOBALS_INTERPRETER);
-
-    /*
-     * TODO check if thread flags are consistent
-     */
-    if (interp->flags & PARROT_THR_COPY_INTERP)
-        clone_interpreter(interpreter,
-                (Parrot_Interp)VTABLE_get_pointer(interp, parent),
-                PARROT_CLONE_DEFAULT);
-    /*
-     * TODO thread pools
-     */
-
-    pt_thread_prepare_for_run(interpreter, interp);
-
-    SETATTR_ParrotInterpreter_sub(interp, dest_interp,
-            pt_transfer_sub(interpreter, interp, sub));
-    VTABLE_set_pmc(interp, dest_interp,
-            make_local_args_copy(interpreter, interp, arg));
-
-    /*
-     * create a joinable thread
-     */
-    interpreter->thread_data->state = THREAD_STATE_JOINABLE;
-
-    Parrot_unblock_GC_mark(interpreter);
-    Parrot_unblock_GC_sweep(interpreter);
-    Parrot_unblock_GC_mark(interp);
-    Parrot_unblock_GC_sweep(interp);
-
-    THREAD_CREATE_JOINABLE(interpreter->thread_data->thread,
-            thread_func, dest_interp);
-
-    /* check for pending GC */
-    LOCK(interpreter_array_mutex);
-    if (interp->thread_data->state & THREAD_STATE_SUSPEND_GC_REQUESTED)
-        pt_suspend_one_for_gc(interpreter);
-
-    UNLOCK(interpreter_array_mutex);
-    return 0;
-}
-
-/*
-
 =item C<void pt_thread_yield(void)>
 
 Relinquishes hold on the processor.


More information about the parrot-commits mailing list