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;
}