FreeBASIC  0.91.0
thread_call.c File Reference
#include "fb.h"
Include dependency graph for thread_call.c:

Go to the source code of this file.

Functions

FBTHREADfb_ThreadCall (void *proc, int abi, ssize_t stack_size, int num_args,...)
 ThreadCall: Launches any procedure as new thread, based on libffi. More...
 

Function Documentation

FBTHREAD* fb_ThreadCall ( void *  proc,
int  abi,
ssize_t  stack_size,
int  num_args,
  ... 
)

ThreadCall: Launches any procedure as new thread, based on libffi.

For example:

FB code: declare sub MySub(x as integer, y as integer) thread = threadcall MySub(2, 3) threadwait thread

Turned into this by fbc: a = 2 b = 3 thread = fb_ThreadCall(, STDCALL, 2, INT, , INT, ) fb_ThreadWait(thread)

fb_ThreadCall() packs the call and parameter data it's given into an array of pointers and then launches a thread. The new thread reconstructs the call using LibFFI and then calls the user's procedure.

Definition at line 26 of file thread_call.c.