Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multithreading reference

Status
Not open for further replies.

kidlatngkavite

Programmer
Jul 14, 2003
3
SG
hello! i need help in Multithreading using win32 api. anybody knows a good online reference material a tutorial might be very helpful. thanks very much!
 
////////////client////////////////
#include<iostream>
#include<stdlib.h>
#include<windows.h>
#include<windows.h>
using namespace std;

DWORD WINAPI ThreadProc1(void* xx)
{
while(1)
{
cout<< &quot;&quot;<< endl;
}
return 0;
}
DWORD WINAPI ThreadProc2(void* xx)
{
while(1)
{
cout<< &quot;******&quot;<< endl;
}
return 0;
}

int main(HINSTANCE, HINSTANCE, LPSTR, int)
{

ULONG th_id;
HANDLE hThreadSvr = 0;
someparams x;
hThreadSvr = CreateThread(0, 0, ThreadProc1, (void*)&x, 0, &th_id);
if(!hThreadSvr){printf(&quot;error on creating thread 1&quot;);exit(1);}
hThreadSvr = CreateThread(0, 0, ThreadProc2, (void*)&x, 0, &th_id);
if(!hThreadSvr){printf(&quot;error on creating thread 2&quot;);exit(1);}
return 0;
}
////////////client////////////////

Ion Filipski
1c.bmp

ICQ: 95034075
AIM: IonFilipski
filipski@excite.com
 
replace:
DWORD WINAPI ThreadProc1(void* xx)
{
while(1)
{
cout<< &quot;hello&quot;<< endl;
}
return 0;
}


Ion Filipski
1c.bmp

ICQ: 95034075
AIM: IonFilipski
filipski@excite.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top