Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: pthread_* functionality currently in OS X



On Wednesday, March 27, 2002, at 11:39  AM, Baskaran Subramaniam wrote:

I am not sure if this is a bug even though Matt has filed it as a bug.
According to POSIX 1003.1c-1995 interface definition (page 315 of
Programming with POSIX threads by David R. Butenhof):

pthread_exit(void *value_ptr) terminates the calling thread, returning
the value value_ptr to any joining thread.

pthread_join(pthread_t thread, void **value_ptr) waits for the thread to
terminate, and return thread's exit value if value_ptr is not NULL. This also
detaches thread on successful completion.


What is wrong with the way these functions are behaving currently in darwin/Mac OS X?
Isn't LinuxPPC doing something that is not required by the POSIX spec?

No, this is a bug. See:

http://groups.google.com/groups?as_umsgid=email@hidden
http://groups.google.com/groups?as_umsgid=email@hidden

Also, SUSv3 states:

http://www.opengroup.org/onlinepubs/007904975/functions/pthread_exit.html

The process shall exit with an exit status of 0 after the last thread has been terminated. The behavior shall be as if the implementation called exit() with a zero argument at thread termination time.

"return n;" from main() is supposed to terminate the program as if exit(n) were called. This "evaporates" any remaining threads. pthread_exit() from main is supposed to terminate the main thread, but the program will not exit until the last thread terminates.


matt.
_______________________________________________
unix-porting mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/unix-porting
Do not post admin requests to the list. They will be ignored.





Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.