Scheme_Object *scheme_thread(Scheme_Object *thunk, Scheme_Config *config)
Creates a new thread, using the given parameterization for the new thread. If config is NULL, a new parameterization is created using the current thread's parameterization's current base parameterization. The new thread begins evaluating the application of the procedure thunk (with no arguments).
Scheme_Object *scheme_make_sema(long v)
Creates a new semaphore.
void scheme_post_sema(Scheme_Object *sema)
Posts to sema.
int scheme_wait_sema(Scheme_Object *sema, int try)
Waits on sema. If try is not 0, the wait can fail and 0 is returned for failure, otherwise 1 is returned.
void scheme_process_block(float sleep_time)
Swaps out the current thread in favor of other threads. If sleep_time is not 0, then this process will sleep for at least sleep_time seconds.
void scheme_swap_process(Scheme_Process *process)
Swaps out the current thread in favor of process.
void scheme_break_thread(Scheme_Process *thread)
Issues a user-break in the given thread.
int scheme_break_waiting(Scheme_Process *thread)
Returns 1 if a break from break-thread or scheme_break_thread has occured in the specified process but has not yet been handled.
int scheme_block_until(int (*f)(Scheme_Object *data), void (*fdf)(Scheme_Object *data, void *fds), void *data, floatsleep)
Blocks the current thread until f returns a true value, or at least blocks sleep seconds. The f function is called periodically, and it may be called multiple times even after it returns a true value. (If f ever returns a true value, it must continue to return a true value.) The argument to f is the same data as provided to scheme_block_until, and data is ignored otherwise. (The type mismatch between void* and Scheme_Object* is an ugly artifact. The data argument is not intended to necessarily be a Scheme_Object* value.)
If MzScheme decides to sleep, then the fdf function is called to sets bits in fds, conceptually an array of three fd_sets: one or reading, one for writing, and one for exceptions. Use scheme_get_fdset to get elements of this array, and manipulate an ``fd_set'' with MZ_FD_XXX instead of FD_XXX. The fdf argument can be NULL.
void scheme_check_threads()
This function is periodically called by the embedding program to give background processes time to execute. See section 3.7.1 for more information.
void scheme_wake_up()
This function is called by the embedding program when there is input on an external file descriptor. See section 3.7.2 for more information.
void *scheme_get_fdset(void *fds)
Extracts an ``fd_set'' from an array passed to scheme_sleep, a callback for scheme_block_until, or an input port callback for scheme_make_input_port.
int scheme_tls_allocate()
Allocates a thread local storage index to be used with scheme_lts_set and scheme_lts_get.
void scheme_tls_set(int index, void *v)
Stores a thread-specific value using an index allocated with scheme_tls_allocate.
void *scheme_tls_get(int index)
Retrieves a thread-specific value installed with scheme_tls_set. If no thread-specific value is available for the given index, NULL is returned.