![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#11 |
|
PFO God In Training
![]() Join Date: Jun 2005
Location: near St Louis, MO. (USA)
Posts: 489
Rep Power: 4
![]() |
Re: Help!!!!!!!!!!!
Here is the MS-Windows version of that program using VC++ 2008 Express
#include <windows.h>
#include <stdlib.h>
#include <stdio.h>
int myglobal;
DWORD WINAPI thread_function(LPVOID arg) {
int i,j;
for ( i=0; i<20; i++ ) {
j=myglobal;
j=j+1;
printf(".");
fflush(stdout);
Sleep(1000);
myglobal=j;
}
return 0;
}
int main(void) {
int i;
HANDLE hThread = CreateThread(0, 0, thread_function, 0, 0, 0);
if ( hThread == NULL ) {
printf("error creating thread.");
return 1;
}
for ( i=0; i<20; i++) {
myglobal=myglobal+1;
printf("o");
fflush(stdout);
Sleep(1000);
}
printf("\nmyglobal equals %d\n",myglobal);
return 0;
}
__________________
I Like Ike. Vote for Dwight Eisenhower this November. --This message brought to you by the the Procrastinators Club Of America. |
|
|
|
|
|
#12 |
|
Newbie
Join Date: Apr 2008
Posts: 19
Rep Power: 0
![]() |
Re: Help!!!!!!!!!!!
Thank You Ancient Dragon.
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|