Tuesday, February 05, 2008

Multi-thread

// Sender is the function to call

hThread = CreateThread(
NULL, // default security attributes
0, // use default stack size
Sender, // thread function
&dwThrdParam,// argument to thread function
0, // use default creation flags
&dwThreadId);// returns the thread identifier

char msg[20];
for (i = 0; i < ncamera; i++)
{
sprintf(msg,"MutexName%d",i);
hMutex[i] = CreateMutex(
NULL, // no security attributes
FALSE, // initially not owned
msg);
}

'Sender' function could be in another file:

DWORD WINAPI Sender(LPVOID pParam)
{
...
}

No comments:

Post a Comment