parrotcode: Thread handling stuff | |
Contents | C |
src/thread.c - Thread handling stuff
Threads are created by creating new ParrotInterpreter
objects.
PARROT_CAN_RETURN_NULL static PMC *make_local_copy(PARROT_INTERP, NOTNULL(Parrot_Interp from), NULLOK(PMC *arg))
PARROT_CAN_RETURN_NULL static Shared_gc_info *get_pool(PARROT_INTERP)
PARROT_CAN_RETURN_NULL static PMC *make_local_args_copy(PARROT_INTERP, Parrot_Interp old_interp, NULLOK(PMC *args))
PARROT_CAN_RETURN_NULL PMC *pt_shared_fixup(PARROT_INTERP, NOTNULL(PMC *pmc))
static void pt_thread_signal(NOTNULL(Parrot_Interp self), PARROT_INTERP)
interp
which should have called pt_thread_wait().void pt_thread_wait_with(PARROT_INTERP, NOTNULL(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)
interpreter_array_mutex
is assumed held.
Spurious wakeups may occur.PARROT_CAN_RETURN_NULL static void *thread_func(NULLOK(void *arg))
void pt_clone_code(Parrot_Interp d, Parrot_Interp s)
s
to d
.
All resources are created in d
.static void pt_ns_clone(NOTNULL(Parrot_Interp d), NOTNULL(PMC *dest_ns), NOTNULL(Parrot_Interp s), NOTNULL(PMC *source_ns))
s
to d
.void pt_clone_globals(Parrot_Interp d, Parrot_Interp s)
void pt_thread_prepare_for_run(Parrot_Interp d, Parrot_Interp s)
PARROT_CAN_RETURN_NULL PMC *pt_transfer_sub(Parrot_Interp d, Parrot_Interp s, NULLOK(PMC *sub))
int pt_thread_run(PARROT_INTERP, NOTNULL(PMC *dest_interp), NULLOK(PMC *sub), NULLOK(PMC *arg))
*sub
PMC in a separate thread using interpreter in *dest_interp
.arg
should be an array of arguments for the subroutine.
intint pt_thread_run_1(PARROT_INTERP, NOTNULL(PMC *dest_interp), NULLOK(PMC *sub), NULLOK(PMC *arg))
int pt_thread_run_2(PARROT_INTERP, NOTNULL(PMC *dest_interp), NULLOK(PMC *sub), NULLOK(PMC *arg))
int pt_thread_run_3(PARROT_INTERP, NOTNULL(PMC *dest_interp), NULLOK(PMC *sub), NULLOK(PMC *arg))
void pt_thread_yield(void)
static Parrot_Interp pt_check_tid(UINTVAL tid, ARGIN(const char *from))
tid
is valid.
The caller holds the mutex.
Returns the interpreter for tid
.static void mutex_unlock(NOTNULL(void *arg))
*arg
.PARROT_WARN_UNUSED_RESULT static int is_suspended_for_gc(PARROT_INTERP)
interp
is suspended so a global GC can be performed.
interpreter_array_mutex must be held.PARROT_CAN_RETURN_NULL static QUEUE_ENTRY *remove_queued_suspend_gc(PARROT_INTERP)
static int pt_gc_count_threads(PARROT_INTERP)
static void pt_gc_wait_for_stage(PARROT_INTERP, thread_gc_stage_enum from_stage, thread_gc_stage_enum to_stage)
static void pt_gc_wakeup_check(PARROT_INTERP)
static void pt_suspend_one_for_gc(PARROT_INTERP)
interpreter_array_mutex
assumed held.static void pt_suspend_all_for_gc(PARROT_INTERP)
void pt_suspend_self_for_gc(PARROT_INTERP)
PARROT_CAN_RETURN_NULL PMC *pt_thread_join(NOTNULL(Parrot_Interp parent), UINTVAL tid)
void pt_join_threads(PARROT_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, Parrot_Interp new_interp)
void pt_DOD_start_mark(PARROT_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)
void pt_DOD_stop_mark(PARROT_INTERP)
PARROT_API void Parrot_shared_DOD_block(PARROT_INTERP)
PARROT_API void Parrot_shared_DOD_unblock(PARROT_INTERP)
|