help-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: strage cthread behavior


From: James Morrison
Subject: Re: strage cthread behavior
Date: Sat, 29 Jun 2002 13:53:11 -0700 (PDT)

--- Matej Kosik <kosik@decef.elf.stuba.sk> wrote:
> Hi
> 
> I started playing with hurd. I am trying
> to gain some experience with `cthread'
> library now.
> 
> I wrote following trivial program:
> 
> ------------------------------------
> #include <stdio.h>
> #include <cthreads.h>
> 
> void child_fnc( int i )
> {
>         printf( "slave:0\n" );
> }
> 
> int main()
> {
>         cthread_t child_thread;
>         child_thread = cthread_fork( child_fnc, 30 );
>         printf( "master:0\n" );
>         cthread_join( child_thread );
>         printf( "master:1\n" );
>         return 0;
> }
> ------------------------------------
> 
> 
> 
> if I run it as
> 
>       ./main
> 
> it gives me the output
> 
>       master:0
>       slave:0
>       master:1
> 
> e.g. one of the things which I expected
> 
> ------------------------------------
> 
> if I run the same program as
> 
>       ./main > output
> 
> the contents of the `./output' file
> will be (surprisingly)
> 
>       slave:0
>       master:1
> 
> I expected the contents of `./output' file
> to be the same as the output of the program
> printed out on terminal.
> 
> Can somebody please explain it to me?

 I can't explain it, but the problem is the master:0 does not seem to be
printed
anywhere, correct?


=====
James Morrison
   University of Waterloo
   Computer Science - Digital Hardware
   2A co-op
http://hurd.dyndns.org

Anyone referring to this as 'Open Source' shall be eaten by a GNU

__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com



reply via email to

[Prev in Thread] Current Thread [Next in Thread]