Understanding Threads

Jonathan Wakely jwakely.gcc@gmail.com
Tue Jun 5 17:54:00 GMT 2012


On 5 June 2012 15:28, parc wrote:
>
> Hello,
>
> I'm trying to install gcc-4.7 and have problems with the posix threads,
> especially with the PTHREAD_ONCE_INIT decalration in the pthread.h file.
> When installing, it often ends up with this
>
> error: ‘PTHREAD_ONCE_INIT’ undeclared here (not in a function)  static
> pthread_once_t create_key_once = PTHREAD_ONCE_INIT;

That error message would have said which file and line the error came
from, but you have omitted that essential information.


> So, it would be very helpful to understand what the definition of
> "PTHREAD_ONCE_INIT" is about. If it's a fixed size or address value and what
> it's role when handling threads.

It doesn't come from GCC. See 'man pthread_once' or
http://pubs.opengroup.org/onlinepubs/7908799/xsh/pthread_once.html for
details.

> Moreover there are some different versions of pthread. The one wich created
> the error above, i can't find now.

Noone will be able to help you unless you provide more information.
What are you trying to do?  You say installing GCC, but you also say
it "often ends up with" an error which shouldn't come from GCC.
Describe *exactly* what you are doing, provide the exact commands you
used and the exact output and what platform you are working on.



More information about the Gcc-help mailing list