This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: threads in C++

On Mon, 15 Nov 1999 17:40:17 GMT, you wrote:

>In article <> you write:
>>Jonathan Larmour wrote:
>>> In article <382f1edb.37731544@busybee> you write:
>>> >On Sat, 13 Nov 1999 15:01:31 PST, you wrote:
>>> >
>>> >>I would like to use a C++ class member function as the starting point for a
>>> >>thread.
>>> >
>>> >You cannot. The starting function must be
>>> >
>>> >extern "C" void* your_function_name_here (void*);
>>> Not necessarily. You could use a static member function. But if you need
>>> to get at object data, you'll have to get that passed in explicitly.
>>POSIX doesn't say you can use a "static member function", ergo you can not. If
>>the trick works for g++, it doesn't mean it will work for any other compiler.
>No, POSIX only stipulates that the argument has the form:
>void * (*start_routine)(void *)

POSIX defines C interfaces and says nothing about C++.

>C++ defines that if a static class member function is declared as e.g.
>static void *func(void *), then if you take the address of this function,
>it has the required type for pthread_create. This is well-defined behaviour
>in C++.

Would you please give me the exact reference to where in the Standard
this behavior is defined? Or just save your time and see section 9.2.5
in _The C++ Programming Language_, Third Edition, by Bjarne Stroustrup.

>There is nothing g++-specific here.




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]