C modunda örnek


#include
#include

DWORD thread;

DWORD WINAPI mThread(LPVOID param)
{
int lp=(int)param;
while(1)
{
printf("%c\n",lp);
Sleep(1000);
if(lp == 'g')
ExitThread(0);
++lp;
}
}

int main(int argc, char *argv[])
{
int a='a',b='b';
CreateThread(NULL, 0, mThread,(LPVOID)a, 0, &thread);
Sleep(500);
CreateThread(NULL, 0, mThread,(LPVOID)b, 0, &thread);
getchar();
return 0;
}