vm/kite_thread.c File Reference

#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_tkite_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_tkite_new_thread_bytecode (kite_vm_t *vm, void *start)
kite_thread_tkite_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_tkite_signal_handlers [NSIG+1]

Define Documentation

#define PTHREAD_STACK_SIZE   4194304


Function Documentation

void kite_exit_thread ( kite_vm_t vm,
kite_thread_t thd 
)

Force thread to terminate.

Parameters:
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.

Parameters:
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).

Parameters:
vm Virtual machine to create thread on.
ptr Pointer to bytecode to start.
Returns:
A new thread object.

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).

Parameters:
vm Virtual machine to create thread on.
ptr Pointer to function to start.
Returns:
A new thread object.

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.

Parameters:
vm The virtual machine to create the thread on.
Returns:
A new thread object.

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.

Parameters:
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.

Parameters:
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().


Variable Documentation


Generated on Sun Feb 8 19:42:48 2009 for Kite by  doxygen 1.5.6