* OSELAS.Toolchain-2011.03.0: PTHREAD_PRIO_INHERIT undeclared for arm-1136jfs-linux-gcc
@ 2012-01-04 11:34 Daniel Lehne
2012-01-04 18:06 ` Khem Raj
0 siblings, 1 reply; 5+ messages in thread
From: Daniel Lehne @ 2012-01-04 11:34 UTC (permalink / raw)
To: crossgcc
Hello,
in c++ the protocol PTHREAD_PRIO_INHERIT protocol for mutexes is
available, but for c it is not available.
I've traced it up to features.h which declares __USE_UNIX98 for
_XOPEN_SOURCE = 500. Once __USE_UNIX98 is set the protocols are
available in pthread.h. How it is activated by c++, i don't know. It is
confusing, because pthread_mutexattr_setprotocol() is declared but the
protocols not.
simple example - reproduce on compile everytime:
/* test of problem PTHREAD_PRIO_INHERIT undeclared in pthread.h (only in
gcc, cpp with g++ no problem) */
/* toolchain:
OSELAS.Toolchain-2011.03.0/arm-1136jfs-linux-gnueabi/gcc-4.5.2-glibc-2.13-binutils-2.21-kernel-2.6.36-sanitized/bin/arm-1136jfs-linux-gnueabi-gcc
*/
/* linked libs: pthread */
#include <pthread.h>
int main(int argc, char* argv[])
{
int iRet;
pthread_mutexattr_t csAttr;
iRet = pthread_mutexattr_init(&csAttr);
if (iRet == 0)
iRet = pthread_mutexattr_settype(&csAttr, PTHREAD_MUTEX_ERRORCHECK);
if (iRet == 0)
iRet = pthread_mutexattr_setprotocol(&csAttr,
PTHREAD_PRIO_INHERIT); // error: PTHREAD_PRIO_INHERIT undeclared
pthread_mutexattr_destroy(&csAttr);
return 0;
}
This example was build with the following configuration and output:
Building file: ../main.c
Invoking: GCC C Compiler
/opt/OSELAS.Toolchain-2011.03.0/arm-1136jfs-linux-gnueabi/gcc-4.5.2-glibc-2.13-binutils-2.21-kernel-2.6.36-sanitized/bin/arm-1136jfs-linux-gnueabi-gcc
-O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"main.d" -MT"main.d"
-o"main.o" "../main.c"
../main.c: In function 'main':
../main.c:14:51: error: 'PTHREAD_PRIO_INHERIT' undeclared (first use in
this function)
../main.c:14:51: note: each undeclared identifier is reported only once
for each function it appears in
make: *** [main.o] Error 1
make: Target `all' not remade because of errors.
Why this protocol is only for __USE_UNIX98 allowed? Is there a solution
to use this protocol PTHREAD_PRIO_INHERIT with gcc?
Best regards!
--
For unsubscribe information see http://sourceware.org/lists.html#faq
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: OSELAS.Toolchain-2011.03.0: PTHREAD_PRIO_INHERIT undeclared for arm-1136jfs-linux-gcc
2012-01-04 11:34 OSELAS.Toolchain-2011.03.0: PTHREAD_PRIO_INHERIT undeclared for arm-1136jfs-linux-gcc Daniel Lehne
@ 2012-01-04 18:06 ` Khem Raj
2012-01-05 6:31 ` Daniel Lehne
0 siblings, 1 reply; 5+ messages in thread
From: Khem Raj @ 2012-01-04 18:06 UTC (permalink / raw)
To: Daniel Lehne; +Cc: crossgcc
On (04/01/12 13:34), Daniel Lehne wrote:
> Hello,
>
> in c++ the protocol PTHREAD_PRIO_INHERIT protocol for mutexes is
> available, but for c it is not available.
> I've traced it up to features.h which declares __USE_UNIX98 for
> _XOPEN_SOURCE = 500. Once __USE_UNIX98 is set the protocols are
> available in pthread.h. How it is activated by c++, i don't know. It
> is confusing, because pthread_mutexattr_setprotocol() is declared
> but the protocols not.
>
> simple example - reproduce on compile everytime:
>
> /* test of problem PTHREAD_PRIO_INHERIT undeclared in pthread.h
> (only in gcc, cpp with g++ no problem) */
> /* toolchain: OSELAS.Toolchain-2011.03.0/arm-1136jfs-linux-gnueabi/gcc-4.5.2-glibc-2.13-binutils-2.21-kernel-2.6.36-sanitized/bin/arm-1136jfs-linux-gnueabi-gcc
> */
> /* linked libs: pthread */
>
> #include <pthread.h>
>
> int main(int argc, char* argv[])
> {
> int iRet;
> pthread_mutexattr_t csAttr;
>
> iRet = pthread_mutexattr_init(&csAttr);
> if (iRet == 0)
> iRet = pthread_mutexattr_settype(&csAttr, PTHREAD_MUTEX_ERRORCHECK);
> if (iRet == 0)
> iRet = pthread_mutexattr_setprotocol(&csAttr,
> PTHREAD_PRIO_INHERIT); // error: PTHREAD_PRIO_INHERIT undeclared
>
> pthread_mutexattr_destroy(&csAttr);
> return 0;
> }
>
> This example was build with the following configuration and output:
> Building file: ../main.c
> Invoking: GCC C Compiler
> /opt/OSELAS.Toolchain-2011.03.0/arm-1136jfs-linux-gnueabi/gcc-4.5.2-glibc-2.13-binutils-2.21-kernel-2.6.36-sanitized/bin/arm-1136jfs-linux-gnueabi-gcc
> -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"main.d" -MT"main.d"
> -o"main.o" "../main.c"
> ../main.c: In function 'main':
> ../main.c:14:51: error: 'PTHREAD_PRIO_INHERIT' undeclared (first use
> in this function)
> ../main.c:14:51: note: each undeclared identifier is reported only
> once for each function it appears in
> make: *** [main.o] Error 1
> make: Target `all' not remade because of errors.
>
> Why this protocol is only for __USE_UNIX98 allowed? Is there a
> solution to use this protocol PTHREAD_PRIO_INHERIT with gcc?
add #define _GNU_SOURCE
at the top of your source file.
--
For unsubscribe information see http://sourceware.org/lists.html#faq
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: OSELAS.Toolchain-2011.03.0: PTHREAD_PRIO_INHERIT undeclared for arm-1136jfs-linux-gcc
2012-01-04 18:06 ` Khem Raj
@ 2012-01-05 6:31 ` Daniel Lehne
2012-01-05 18:08 ` Khem Raj
0 siblings, 1 reply; 5+ messages in thread
From: Daniel Lehne @ 2012-01-05 6:31 UTC (permalink / raw)
To: Khem Raj; +Cc: crossgcc
On 04.1.2012 г. 20:06, Khem Raj wrote:
> On (04/01/12 13:34), Daniel Lehne wrote:
>> Hello,
>>
>> Why this protocol is only for __USE_UNIX98 allowed? Is there a
>> solution to use this protocol PTHREAD_PRIO_INHERIT with gcc?
> add #define _GNU_SOURCE
> at the top of your source file.
>
>
I've tried it already __GNU_SOURCE don't works because of _XOPEN_SOURCE
= 600. I don't want to make changes in features.h. May i will set
__USE_UNIX98 directly in source before the usage of phtread.h. Your
answer shows me, this PTHREAD_PRIO_INHERIT should be available also for
c source (gcc).
Thanks!
--
For unsubscribe information see http://sourceware.org/lists.html#faq
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: OSELAS.Toolchain-2011.03.0: PTHREAD_PRIO_INHERIT undeclared for arm-1136jfs-linux-gcc
2012-01-05 6:31 ` Daniel Lehne
@ 2012-01-05 18:08 ` Khem Raj
2012-01-06 6:24 ` Daniel Lehne
0 siblings, 1 reply; 5+ messages in thread
From: Khem Raj @ 2012-01-05 18:08 UTC (permalink / raw)
To: Daniel Lehne; +Cc: crossgcc
On Wed, Jan 4, 2012 at 10:31 PM, Daniel Lehne
<daniel.lehne@amk-drives.bg> wrote:
> On 04.1.2012 г. 20:06, Khem Raj wrote:
>>
>> On (04/01/12 13:34), Daniel Lehne wrote:
>>>
>>> Hello,
>>>
>>> Why this protocol is only for __USE_UNIX98 allowed? Is there a
>>> solution to use this protocol PTHREAD_PRIO_INHERIT with gcc?
>>
>> add #define _GNU_SOURCE
>> at the top of your source file.
>>
>>
> I've tried it already __GNU_SOURCE don't works because of _XOPEN_SOURCE =
> 600. I don't want to make changes in features.h. May i will set __USE_UNIX98
> directly in source before the usage of phtread.h. Your answer shows me, this
> PTHREAD_PRIO_INHERIT should be available also for c source (gcc).
>
take your source add
#define _GNU_SOURCE to it on top
or add it on cmdline like below
-D_GNU_SOURCE
is that too hard ?
> Thanks!
>
--
For unsubscribe information see http://sourceware.org/lists.html#faq
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: OSELAS.Toolchain-2011.03.0: PTHREAD_PRIO_INHERIT undeclared for arm-1136jfs-linux-gcc
2012-01-05 18:08 ` Khem Raj
@ 2012-01-06 6:24 ` Daniel Lehne
0 siblings, 0 replies; 5+ messages in thread
From: Daniel Lehne @ 2012-01-06 6:24 UTC (permalink / raw)
To: Khem Raj; +Cc: crossgcc
On 05.1.2012 г. 20:08, Khem Raj wrote:
> On Wed, Jan 4, 2012 at 10:31 PM, Daniel Lehne
> <daniel.lehne@amk-drives.bg> wrote:
>> On 04.1.2012 г. 20:06, Khem Raj wrote:
>>> On (04/01/12 13:34), Daniel Lehne wrote:
>>>> Hello,
>>>>
>>>> Why this protocol is only for __USE_UNIX98 allowed? Is there a
>>>> solution to use this protocol PTHREAD_PRIO_INHERIT with gcc?
>>> add #define _GNU_SOURCE
>>> at the top of your source file.
>>>
>>>
>> I've tried it already __GNU_SOURCE don't works because of _XOPEN_SOURCE =
>> 600. I don't want to make changes in features.h. May i will set __USE_UNIX98
>> directly in source before the usage of phtread.h. Your answer shows me, this
>> PTHREAD_PRIO_INHERIT should be available also for c source (gcc).
>>
> take your source add
> #define _GNU_SOURCE to it on top
> or add it on cmdline like below
>
> -D_GNU_SOURCE
>
> is that too hard ?
>
>> Thanks!
>>
>>
Thank for the correction. Of course _GNU_SOURCE works, when it's defined(spelled) correctly.
--
For unsubscribe information see http://sourceware.org/lists.html#faq
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-01-06 6:24 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-04 11:34 OSELAS.Toolchain-2011.03.0: PTHREAD_PRIO_INHERIT undeclared for arm-1136jfs-linux-gcc Daniel Lehne
2012-01-04 18:06 ` Khem Raj
2012-01-05 6:31 ` Daniel Lehne
2012-01-05 18:08 ` Khem Raj
2012-01-06 6:24 ` Daniel Lehne
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).