#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <setjmp.h>
#include <pthread.h>
#include <signal.h>
#include "objs/kite_object.h"
#include "objs/kite_gc.h"
#include "kite_vm.h"
#include <unistd.h>
Defines | |
#define | PTHREAD_STACK_SIZE 4194304 |
Functions | |
void | kite_handle_signal (int sig) |
kite_thread_t * | kite_new_thread_without_start (kite_vm_t *vm) |
void | kite_start_bytecode (kite_thread_t *thd, void *start) |
void | kite_start_compiled (kite_thread_t *thd, void *start) |
kite_thread_t * | kite_new_thread_bytecode (kite_vm_t *vm, void *start) |
kite_thread_t * | kite_new_thread_compiled (kite_vm_t *vm, void *start) |
void | kite_join_thread (kite_vm_t *vm, kite_thread_t *thd) |
void | kite_exit_thread (kite_vm_t *vm, kite_thread_t *thd) |
Variables | |
struct kite_object_t * | kite_signal_handlers [NSIG+1] |
#define PTHREAD_STACK_SIZE 4194304 |
Referenced by kite_start_bytecode(), and kite_start_compiled().
void kite_exit_thread | ( | kite_vm_t * | vm, | |
kite_thread_t * | thd | |||
) |
Force thread to terminate.
vm | The VM to operate on. | |
thd | The thread to wait for. |
References kite_join_thread(), kite_thread_t::start, kite_thread_t::thread, and kite_thread_t::vm.
Referenced by kite_free_vm().
void kite_handle_signal | ( | int | sig | ) |
void kite_join_thread | ( | kite_vm_t * | vm, | |
kite_thread_t * | thd | |||
) |
Wait for thread to terminate.
vm | The VM to operate on. | |
thd | The thread to wait for. |
References kite_thread_t::thread, kite_vm_t::thread_list, and kite_thread_t::vm.
Referenced by kite_exit_thread().
kite_thread_t* kite_new_thread_bytecode | ( | kite_vm_t * | vm, | |
void * | ptr | |||
) |
Create a new bytecode thread (and start it).
vm | Virtual machine to create thread on. | |
ptr | Pointer to bytecode to start. |
References kite_new_thread_without_start(), and kite_start_bytecode().
kite_thread_t* kite_new_thread_compiled | ( | kite_vm_t * | vm, | |
void * | ptr | |||
) |
Create a new compiled thread (and start it).
vm | Virtual machine to create thread on. | |
ptr | Pointer to function to start. |
References kite_new_thread_without_start(), and kite_start_compiled().
kite_thread_t* kite_new_thread_without_start | ( | kite_vm_t * | vm | ) |
Create a new thread without starting it.
vm | The virtual machine to create the thread on. |
References kite_thread_t::entry, kite_thread_t::func_stack, kite_vm_t::numthreads, kite_thread_t::running_stack, kite_thread_t::start, kite_vm_t::thread_list, and kite_thread_t::vm.
Referenced by kite_free_vm(), kite_new_thread_bytecode(), kite_new_thread_compiled(), and kite_new_vm().
void kite_start_bytecode | ( | kite_thread_t * | thd, | |
void * | ptr | |||
) |
Start preexisting thread with bytecode.
thd | The thread to start. | |
ptr | Pointer to bytecode to run. |
References kite_vm_execute(), PTHREAD_STACK_SIZE, kite_thread_t::start, kite_thread_t::thread, kite_vm_t::thread_list, and kite_thread_t::vm.
Referenced by kite_new_thread_bytecode().
void kite_start_compiled | ( | kite_thread_t * | thd, | |
void * | ptr | |||
) |
Start preexisting thread with compiled C function.
thd | The thread to start. | |
ptr | Pointer to C function to run. |
References PTHREAD_STACK_SIZE, kite_thread_t::start, kite_thread_t::thread, kite_vm_t::thread_list, and kite_thread_t::vm.
Referenced by kite_new_thread_compiled().
struct kite_object_t* kite_signal_handlers[NSIG+1] |