Example Posix, wath's wrong ?

Joel Sherrill joel.sherrill at oarcorp.com
Thu Feb 16 14:21:06 UTC 2006


Matteo wrote:

>Hi
>What's wrong in so this simple example of posix threads ? I have error when I
>launch it on the pthread_create and pthread_join .
>I compile it correctly using the makefile of hello world.
>  
>
OK.  It was VERY close.  :)

You forgot to have a CONFIGURE_INIT at the bottom before including 
confdefs.h
so you did not actually instantiate the configuration you specified.

I also tinkered with the example to use distinct variables for child1 
and child2 IDs,
to capture the status variable so you can look at it in the debugger, to 
use a POSIX
thread as the init task as you specified in the configuration, and to 
exit at the bottom
of your main thread.  As it was, the main thread returned and the system 
did not
exit.

Runs now.  It isn't as different as it sounds, just cleaned up a bit.  
Really only two
functional changes.

--joel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.c
Type: text/x-csrc
Size: 1067 bytes
Desc: not available
URL: <http://lists.rtems.org/pipermail/users/attachments/20060216/8d101128/attachment-0001.bin>


More information about the users mailing list