NAME ^

src/pmc/parrotthread.pmc - Threaded Interpreter

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

Methods ^

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 cloneflags.pasm.

thread_id = thread.'run_clone'(sub, args...)

Equivalent to calling run with PARROT_CLONE_DEFAULT.

void init()

Initializes the thread.

void init_pmc(PMC *parent)

Create a new thread by cloning the passed interpreter.

HISTORY ^

2003.12.18 leo initial review.


parrot