From: The C. <Th...@gm...> - 2003-01-09 22:08:20
|
here it is, a reduced version based on libSDL: int threadfunc(void *data) { for(int i = 0; i < 50; i++) { cout << "Thread reports for the " << (i + 1) << " time" << endl; SDL_Delay(100); }; return 0; }; // WinMain SDL_Thread** threads; threads = new SDL_Thread*[5]; for(int i = 0; i < 5; i++) threads[i] = SDL_CreateThread(threadfunc, 0); for(int i = 0; i < 5; i++) SDL_WaitThread(threads[i], 0); // ... most lines of the output are correct but there are these annoying errors. I am using Dev-C++ 4.9.7.0 to compile. If IOStreams were threadsafe each of these lines output would be displayed correctly. Or not? |