This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: fork()


Corinna Vinschen wrote:
> 
> Your example is wrong. The output to stdout is line buffered. That means,

Another problem is, the code depends on the OS's multitasking
characteristics.  There's nothing explicit in the code that says the OS
has to take the time slice away from the parent or the child.  If you
threw in a line like this:

	if (rand() % 2) sleep(0);

after each print statement, you might reasonably expect randomness in
the output.
-- 
= Warren -- ICBM Address: 36.8274040 N, 108.0204086 W, alt. 1714m

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]