Boost logo

Boost :

From: williamkempf_at_[hidden]
Date: 2001-06-22 09:05:04


--- In boost_at_y..., Lois Goldthwaite <loisg_at_o...> wrote:
> Bill Kempf wrote:
> >>static thread * create(void (*threadfunc)(void*), void* param);
> Greg Colvin wrote:
> > Is the ugly (void (*threadfunc)(void*), void* param) really
needed?
>
> I haven't dug into your code, but let us not forget that any
function
> used to create a thread must have extern "C" linkage.

This isn't really true, AFAIK. The underlying thread libraries all
require their own linkage specifications, but they are not
universally extern "C". (In fact, Windows threads require __cdecl
for _beginthread() and __stdcall for _beginthreadex()). So unless
you're suggesting that our own interfaces require an extern "C"
linkage (and I can't fathom why), then you're incorrect here.

> A class member
> function, even a static one, won't do. FYI, the Objectspace threads
> library uses an internal driver function with "C" linkage, taking a
> single void * parameter, which points to a structure containing the
real
> thread_func and param pointers. So when the thread starts running
the
> driver function, the first thing it does is invoke threadfunc
(param).

And this makes it sound like you're really discussing the underlying
implementations and not our interface. In which case I'd guess
you're too intimate with pthreads, because this linkage requirement
is not the linkage requirement of all thread libraries. Don't worry,
however, the implementation of Boost.Threads handles the linkage
properly for each implementation.

Bill Kempf


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk