3d1 Subj : Re: returning arguments To : comp.programming.threads From : David Butenhof Date : Tue Jun 28 2005 02:24 pm Torsten Robitzki wrote: > Huub wrote: > >> Is it possible to return more than 1 value from a thread? > > Sure, just use a struct to return what ever you want to. To (perhaps) make this more clear... technically, there's exactly ONE return value from a thread. But the TYPE of that value is "void*" (pointer). You can carry any pointer type in that "void* container". On most contemporary mainstream systems you can get away with carrying any scalar type x with sizeof(x) <= sizeof(void*). However, it's easy enough to malloc a structure and return a pointer to that structure. The joiner can free the storage later. -- Dave Butenhof, David.Butenhof@hp.com HP Utility Pricing software, POSIX thread consultant Manageability Solutions Lab (MSL), Hewlett-Packard Company 110 Spit Brook Road, ZK2/3-Q18, Nashua, NH 03062 . 0