Product SiteDocumentation Site


tc_thread_new, tc_thread_wait, tc_thread_name, tc_current, tc_die — libtcr thread functions


#include <tc/threaded_cr.h>

struct tc_thread *tc_thread_new(void (*func)(void *), void *data, char* name);

enum tc_rv tc_thread_wait(struct tc_thread *tc);

char *tc_thread_name(struct tc_thread *tc);

struct tc_thread *tc_current();

void tc_die();


tc_thread_new() creates a new user space thread and executes the provided func in the context of the newly created thread, data is passed as argument to func. Name may be used for debugging purposes, it should identify the thread in a human readable manner.
tc_thread_wait() waits until tc terminates. It returns immediately if tc does not point to a running thread, i.e. the thread exited before.
tc_thread_name() returns the thread's name.
tc_thread_current() returns the callers struct tc_thread object.
tc_die() is a non returning function. It terminates the currently running thread.


Philipp Reisner