Questo esempio vale per windows (se usi linux il procedimento dovrebbe essere più o meno uguale credo)
codice:
struct MyParam {
/* quel che serve */
};
/* funzione da mandare in multi threading /*
unsigned int WINAPI threadFunction(void* value) {
if (value == NULL) return 1;
struct MyParam* myparam = (struct MyParam*) value;
/* ... */
}
HANDLE hThread;
unsigned int thrdId;
struct MyParam threadFunctionParameters;
int main() {
hthread = (HANDLE) _beginthreadex(NULL,0,threadFunction,&threadFunctionParameters,0, &thrdId);
WaitForSingleObject(hThread,INFINITE);
}