spaace
2010-03-29 13:21:50 UTC
Hi,
i was trying to teach the concepts of threading to someone, and i
couldnt get the typical jumbled output, one usually sees when printing
from 1-n from 2/3 threads.
I could see the jumbled output in VS 2005/XP combination but the other
person running VS2008/Vista could not see it. I have posted the small
code below ... i tried flushing the output and running 2 more
threads .. but i could not get a jumbled output in Vista
I have not stayed upto date on vista / VStudio diffferences for a long
time ... wondering if someone could explain what is affecting the
Vista runs.
Thanks in Advance
Rgds
Arun
#include "stdafx.h"
#include <iostream>
using namespace std;
#include <process.h>
void Mythread ( void * arg )
{
for(int i = 0; i < 10; i++) printf("\n %d", i);
}
int main(int argc, char * argv[])
{
_beginthread(Mythread, 0, NULL);
Mythread(NULL);
return 0;
}
i was trying to teach the concepts of threading to someone, and i
couldnt get the typical jumbled output, one usually sees when printing
from 1-n from 2/3 threads.
I could see the jumbled output in VS 2005/XP combination but the other
person running VS2008/Vista could not see it. I have posted the small
code below ... i tried flushing the output and running 2 more
threads .. but i could not get a jumbled output in Vista
I have not stayed upto date on vista / VStudio diffferences for a long
time ... wondering if someone could explain what is affecting the
Vista runs.
Thanks in Advance
Rgds
Arun
#include "stdafx.h"
#include <iostream>
using namespace std;
#include <process.h>
void Mythread ( void * arg )
{
for(int i = 0; i < 10; i++) printf("\n %d", i);
}
int main(int argc, char * argv[])
{
_beginthread(Mythread, 0, NULL);
Mythread(NULL);
return 0;
}