next up previous contents index
Next: 3.4 The Variable-length String Up: 3.3 A C API Previous: 3.3.4 Obtaining Information about   Contents   Index

3.3.5 Thread Management from Calling Programs

int xsb_ccall_thread_create(th_context *callingThread, th_context **newThread)

Causes callingThread to create a thread pointed to by newThread. newThread runs exactly the same interpreter loop as callingThread and all API functions will work on newThread just as on the main thread, or any other thread. newThread will be non-detached, and will inherit any private parameters from callingThread. To create a thread to do a specific task or a detached thread, rather than one that executes a command loop, simply call the query thread_create/[2,3] from one of the query functions.

th_context *xsb_get_main_thread()

Returns a pointer to the thread context of XSB's main thread. If XSB has not been initialized or has been closed this function returns 0.

xsb_tid xsb_thread_id_to_context(th_context *th)

th_context *xsb_thread_context_to_id(xsb_tid id)



Terrance Swift 2007-10-06