parrotcode: Thread handling stuff | |
Contents | C |
src/thread.c - Thread handling stuff
Threads are created by creating new ParrotInterpreter
objects.
static PMC *make_local_copy(Parrot_Interp interp, Parrot_Interp from, PMC *original)
static PMC *make_local_args_copy(Parrot_Interp interp, PMC *args)
PMC *pt_shared_fixup(Parrot_Interp interp, PMC *pmc)
static void pt_thread_signal(Parrot_Interp self, Parrot_Interp interp)
interp
which should have called pt_thread_wait().void pt_thread_wait_with(Parrot_Interp interp, Parrot_mutex *mutex)
*mutex
is assumed locked on entry and will be locked on exit from this function.
If a GC run occurs in the middle of this function,
then a spurious wakeup may occur.static void pt_thread_wait(Parrot_Interp interp)
interpreter_array_mutex
is assumed held.
Spurious wakeups may occur.static void *thread_func(void *arg)
void pt_clone_code(Parrot_Interp d, Parrot_Interp s)
s
to d
.
All resources are created in d
.void pt_clone_globals(Parrot_Interp d, Parrot_Interp s)
s
to d
.void pt_thread_prepare_for_run(Parrot_Interp d, Parrot_Interp s)
int pt_thread_run(Parrot_Interp interp, PMC *dest_interp, PMC *sub, PMC *arg)
*sub
PMC in a separate thread using interpreter in *dest_interp
.arg
should be an array of arguments for the subroutine.int pt_thread_run_1(Parrot_Interp interp, PMC *dest_interp, PMC *sub, PMC *arg)
int pt_thread_run_2(Parrot_Interp interp, PMC *dest_interp, PMC *sub, PMC *arg)
int pt_thread_run_3(Parrot_Interp interp, PMC *dest_interp, PMC *sub, PMC *arg)
void pt_thread_yield(void)
static Parrot_Interp pt_check_tid(UINTVAL tid, const char *from)
tid
is valid.
The caller holds the mutex.
Returns the interpreter for tid
.static void mutex_unlock(void *arg)
*arg
.static int is_suspended_for_gc(Parrot_Interp interp)
interp
is suspended so a global GC can be performed.
interpreter_array_mutex must be held.static void pt_suspend_one_for_gc(Parrot_Interp interp)
interpreter_array_mutex
assumed held.static int pt_suspend_all_for_gc(Parrot_Interp interp)
void pt_suspend_self_for_gc(Parrot_Interp interp)
PMC *pt_thread_join(Parrot_Interp parent, UINTVAL tid)
void pt_join_threads(Parrot_Interp interp)
interp
.static Parrot_Interp detach(UINTVAL tid)
void pt_thread_detach(UINTVAL tid)
void pt_thread_kill(UINTVAL tid)
void pt_add_to_interpreters(Parrot_Interp interp, Parrot_Interp new_interp)
void pt_DOD_start_mark(Parrot_Interp interp)
PMC->next_for_GC
may be changed.flags
are the DOD flags.
We check if we need to collect shared objects or not.dod_mark_ptr
is updated.void pt_DOD_mark_root_finished(Parrot_Interp interp)
void pt_DOD_stop_mark(Parrot_Interp interp)
void Parrot_shared_DOD_block(Parrot_Interp interp)
void Parrot_shared_DOD_unblock(Parrot_Interp interp)
2003.12.18 leo initial rev
|