[svn:parrot] r46166 - in trunk: editor src/pmc t/pmc

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


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

Log:
Remove old thread pmcs

Deleted:
   trunk/src/pmc/parrotrunningthread.pmc
   trunk/src/pmc/parrotthread.pmc
   trunk/t/pmc/parrotrunningthread.t
Modified:
   trunk/editor/pir-mode.el

Modified: trunk/editor/pir-mode.el
==============================================================================
--- trunk/editor/pir-mode.el	Fri Apr 30 03:33:46 2010	(r46165)
+++ trunk/editor/pir-mode.el	Fri Apr 30 03:48:13 2010	(r46166)
@@ -153,7 +153,7 @@
     "ManagedStruct" "MultiSub" "NCI" "NameSpace" "Null"
     "OS" "Object" "OrderedHash" "PMCProxy" "ParrotClass"
     "ParrotIO" "ParrotInterpreter" "ParrotLibrary" "ParrotObject"
-    "ParrotRunningThread" "ParrotThread" "Pointer"
+    "ParrotThread" "Pointer"
     "ResizableBooleanArray" "ResizableFloatArray" "ResizableIntegerArray"
     "ResizablePMCArray" "ResizableStringArray" "RetContinuation"
     "Role" "Scalar" "String" "Sub" "Super"

Deleted: trunk/src/pmc/parrotrunningthread.pmc
==============================================================================
--- trunk/src/pmc/parrotrunningthread.pmc	Fri Apr 30 03:48:13 2010	(r46165)
+++ /dev/null	00:00:00 1970	(deleted)
@@ -1,164 +0,0 @@
-/*
-Copyright (C) 2006-2008, Parrot Foundation.
-$Id$
-
-=head1 NAME
-
-src/pmc/parrotrunningthread.pmc -- Represents a running Parrot Thread.
-
-=head1 DESCRIPTION
-
-This type represents a running parrot thread.
-
-It provides the following methods:
-    - join
-    - detach
-    - kill
-
-Note that a running thread object becomes invalid when a thread
-finishes while detached or joined. Further operations on the
-object may have unexpected behavior, such as manipulating an
-unrelated thread.
-
-=head2 Methods
-
-=over 4
-
-=cut
-
-*/
-
-#include "parrot/embed.h"
-
-#define PMC_tid(x) (PARROT_PARROTRUNNINGTHREAD(x))->tid
-
-/* HEADERIZER HFILE: none */
-/* HEADERIZER BEGIN: static */
-/* HEADERIZER END: static */
-
-pmclass ParrotRunningThread no_ro auto_attrs {
-    ATTR INTVAL tid; /* thread id */
-
-/*
-
-=item C<void init()>
-
-Create a new, invalid handle to a running thread.
-
-=cut
-
-*/
-
-    VTABLE void init() {
-        PMC_tid(SELF) = -1;
-    }
-
-/*
-
-=item C<void init_pmc(PMC *tid)>
-
-Create a new running thread referring to the thread with
-the Thread ID specified in C<tid>.
-
-=cut
-
-*/
-
-    VTABLE void init_pmc(PMC *tid) {
-        PMC_tid(SELF) = VTABLE_get_integer(INTERP, tid);
-    }
-
-/*
-
-=item C<INTVAL get_integer()>
-
-Return the thread ID of this thread.
-
-=cut
-
-*/
-
-    VTABLE INTVAL get_integer() {
-        return PMC_tid(SELF);
-    }
-
-/*
-
-=item C<void set_integer_native(INTVAL new_tid)>
-
-Change the thread ID we refer to to C<new_tid>.
-
-=cut
-
-*/
-
-    VTABLE void set_integer_native(INTVAL new_tid) {
-        if (new_tid < 0)
-            Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_INTERP_ERROR,
-                "Attempt to set invalid thread id %d", (int)new_tid);
-        PMC_tid(SELF) = new_tid;
-    }
-/*
-
-=item C<METHOD join()>
-
-Join the thread, returning whatever its main method returns.
-
-=cut
-
-*/
-    METHOD join() {
-        PMC *ret = pt_thread_join(INTERP,
-            (UINTVAL)VTABLE_get_integer(INTERP, SELF));
-
-        /* invalidate self */
-        PMC_tid(SELF) = -1;
-
-        RETURN(PMC *ret);
-    }
-
-/*
-
-=item C<METHOD detach()>
-
-Detach the thread so it cannot be joined and will free its resources
-immediately when it exits.
-
-=cut
-
-*/
-
-    METHOD detach() {
-        pt_thread_detach((UINTVAL)VTABLE_get_integer(INTERP, SELF));
-    }
-
-/*
-
-=item C<METHOD kill()>
-
-Terminate a running thread.
-
-=cut
-
-*/
-
-    METHOD kill() {
-        pt_thread_kill((UINTVAL)VTABLE_get_integer(INTERP, SELF));
-    }
-
-}
-
-/*
-
-=back
-
-=cut
-
-*/
-
-/*
- * Local variables:
- *   c-file-style: "parrot"
- * End:
- * vim: expandtab shiftwidth=4:
- */

Deleted: trunk/src/pmc/parrotthread.pmc
==============================================================================
--- trunk/src/pmc/parrotthread.pmc	Fri Apr 30 03:48:13 2010	(r46165)
+++ /dev/null	00:00:00 1970	(deleted)
@@ -1,205 +0,0 @@
-/*
-Copyright (C) 2001-2010, Parrot Foundation.
-$Id$
-
-=head1 NAME
-
-src/pmc/parrotthread.pmc - Threaded Interpreter
-
-=head1 DESCRIPTION
-
-ParrotThread extends ParrotInterpreter to provide a threaded interpreter
-which supports:
-
-    new P2, "ParrotThread"        # create new threaded interp
-    find_method P0, P2, "thread3" # thread-run function
-    find_global P5, "_th1"        # locate thread function
-    invoke                        # run thread
-
-    set I0, P2                    # get thread id
-
-and these methods:
-
-    thread1
-    thread2
-    thread3                   # start thread of type 1..3
-    join
-    detach
-    yield
-    kill
-
-=head2 Methods
-
-=over 4
-
-=cut
-
-*/
-
-#include "parrot/embed.h"
-
-#define PMC_interp(x) ((Parrot_ParrotInterpreter_attributes *)PMC_data(x))->interp
-
-/* HEADERIZER HFILE: none */
-/* HEADERIZER BEGIN: static */
-/* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will be lost. */
-
-static INTVAL do_thread_run(PARROT_INTERP,
-    ARGIN(PMC *thread),
-    INTVAL clone_flags,
-    ARGIN(PMC *sub),
-    ARGIN(PMC *args))
-        __attribute__nonnull__(1)
-        __attribute__nonnull__(2)
-        __attribute__nonnull__(4)
-        __attribute__nonnull__(5);
-
-static void stop_GC(ARGIN(Interp *parent), ARGIN(Interp *thread))
-        __attribute__nonnull__(1)
-        __attribute__nonnull__(2);
-
-#define ASSERT_ARGS_do_thread_run __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(interp) \
-    , PARROT_ASSERT_ARG(thread) \
-    , PARROT_ASSERT_ARG(sub) \
-    , PARROT_ASSERT_ARG(args))
-#define ASSERT_ARGS_stop_GC __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(parent) \
-    , PARROT_ASSERT_ARG(thread))
-/* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will be lost. */
-/* HEADERIZER END: static */
-
-/*
- * can't do multi-threaded GC yet
- * XXX a quick hack to pass the few tests
- */
-static void
-stop_GC(ARGIN(Interp *parent), ARGIN(Interp *thread))
-{
-    ASSERT_ARGS(stop_GC)
-    Parrot_block_GC_mark(parent);
-    Parrot_block_GC_mark(thread);
-    Parrot_block_GC_sweep(parent);
-    Parrot_block_GC_sweep(thread);
-}
-
-/* XXX FIXME probably not the best interface [see also list post of
-   coke's]
- */
-
-static INTVAL
-do_thread_run(PARROT_INTERP, ARGIN(PMC *thread),
-                            INTVAL clone_flags, ARGIN(PMC *sub), ARGIN(PMC *args))
-{
-    ASSERT_ARGS(do_thread_run)
-
-    const INTVAL tid = VTABLE_get_integer(interp, thread);
-
-    if (PMC_IS_NULL(sub)) {
-        Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION,
-            "Invalid thread sub");
-    }
-
-    clone_interpreter(PMC_interp(thread), interp, clone_flags);
-
-    interp->flags &= ~PARROT_THR_COPY_INTERP; /* XXX */
-    pt_thread_run(interp, thread, sub, args);
-
-    Parrot_pmc_reuse(interp, thread, enum_class_ParrotRunningThread, 0);
-
-    PObj_custom_mark_CLEAR(thread);
-    VTABLE_set_integer_native(interp, thread, tid);
-
-    return tid;
-}
-
-pmclass ParrotThread extends ParrotInterpreter no_ro manual_attrs {
-
-/*
-
-=item C<thread_id = thread.'run'(CLONE_FLAGS, sub, args...)>
-
-Run the thread. This object is morphed into an appropriate
-ParrotRunningThread PMC.  The CLONE_FLAGS are or'd together values
-taken from C<cloneflags.pasm>.
-
-=item C<thread_id = thread.'run_clone'(sub, args...)>
-
-Equivalent to calling run with PARROT_CLONE_DEFAULT.
-
-=cut
-
-*/
-
-    METHOD run(INTVAL clone_flags, PMC *sub, PMC *args :slurpy) {
-        const INTVAL retval = do_thread_run(INTERP, SELF, clone_flags, sub, args);
-        RETURN(INTVAL retval);
-    }
-
-    METHOD run_clone(PMC *sub, PMC *args :slurpy) {
-        const INTVAL retval = do_thread_run(INTERP, SELF, PARROT_CLONE_DEFAULT, sub, args);
-        RETURN(INTVAL retval)
-    }
-
-
-/*
-
-=item C<void init()>
-
-Initializes the thread.
-
-=cut
-
-*/
-
-    VTABLE void init() {
-        /* protect interpreter creation and list handling */
-        LOCK(interpreter_array_mutex);
-
-        SUPER();
-        pt_add_to_interpreters(INTERP, PMC_interp(SELF));
-
-        UNLOCK(interpreter_array_mutex);
-
-        /* can't allow GC runs for now */
-        stop_GC(INTERP, PMC_interp(SELF));
-    }
-
-/*
-
-=item C<void init_pmc(PMC *parent)>
-
-Create a new thread by cloning the passed interpreter.
-
-=cut
-
-*/
-
-    VTABLE void init_pmc(PMC *parent) {
-        LOCK(interpreter_array_mutex);
-        SUPER(parent);
-
-        pt_add_to_interpreters(PMC_interp(parent),
-                               PMC_interp(SELF));
-
-        UNLOCK(interpreter_array_mutex);
-
-        /* can't allow GC runs for now */
-        stop_GC(INTERP, PMC_interp(SELF));
-    }
-}
-
-/*
-
-=back
-
-=cut
-
-*/
-
-/*
- * Local variables:
- *   c-file-style: "parrot"
- * End:
- * vim: expandtab shiftwidth=4:
- */

Deleted: trunk/t/pmc/parrotrunningthread.t
==============================================================================
--- trunk/t/pmc/parrotrunningthread.t	Fri Apr 30 03:48:13 2010	(r46165)
+++ /dev/null	00:00:00 1970	(deleted)
@@ -1,56 +0,0 @@
-#!./parrot
-# Copyright (C) 2007-2008, Parrot Foundation.
-# $Id$
-
-=head1 NAME
-
-t/pmc/parrotrunningthread.t - test the ParrotRunningThread PMC
-
-=head1 SYNOPSIS
-
-    % prove t/pmc/parrotrunningthread.t
-
-=head1 DESCRIPTION
-
-Tests the ParrotRunningThread PMC.
-
-=cut
-
-.sub 'main' :main
-    .include 'test_more.pir'
-
-    plan(2)
-
-    new $P0, ['ParrotRunningThread']
-    ok(1, 'Instantiated .ParrotRunningThread')
-
-    test_set_integer_native($P0)
-.end
-
-.sub 'test_set_integer_native'
-    .param pmc thread
-
-    .local string desc
-    desc   = 'setting invalid thread id should throw exception'
-
-    push_eh invalid_thread_id_handler
-    thread = -1
-    pop_eh
-
-    ok(0, desc)
-
-  invalid_thread_id_handler:
-    .local pmc e, c
-    .get_results( e )
-
-    .local string message
-    message   = e
-
-    is( message, 'Attempt to set invalid thread id -1', desc )
-.end
-
-# Local Variables:
-#   mode: pir
-#   fill-column: 100
-# End:
-# vim: expandtab shiftwidth=4 ft=pir:


More information about the parrot-commits mailing list