Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Developer
xsacha
Posts: 90
Registered: ‎10-30-2011
My Device: Blackberry Playbook

PThreads on Playbook

[ Edited ]

Hi,

I'm porting an app that uses 'pthreads' and I'm having trouble getting it to work with Playbook.

Firstly, I noticed there is a pthread.h but no pthread library.

Next, I enabled pthreads in the source and then the QNX headers are throwing this error:

 

usr/include/pthread.h:41:2: error: #error POSIX Threads needs P1003.1b-1993 or later

 I noticed this error occurs when POSIX defined aren't defined. So I decided to define __EXT_POSIX1_199309. It didn't seem to resolve the error.

 

Anyone know the correct way to get pthreads working?

Developer
mreed
Posts: 1,041
Registered: ‎07-16-2008
My Device: ಠ_ಠ

Re: PThreads on Playbook

[ Edited ]

Are you setting any special flags? I have pthreads in my code and it doesn't complain.

 

ref: http://www.openqnx.com/newsgroups/viewtopic.php?f=13&t=14006

Developer
xsacha
Posts: 90
Registered: ‎10-30-2011
My Device: Blackberry Playbook

Re: PThreads on Playbook

[ Edited ]

No special flags that I am aware of. I looked for '-ansi' and it's not anywhere in my Makefile. Is there something else I should be looking for?

 

Also, should there be a pthread library? I can't find any in the NDK.

 

It looks like platforms.h wants -D_POSIX_C_SOURCE=199309 so that it can define the right POSIX. I added this is manually and it's working now. But not sure if that's the correct way to go about it. Should be done automatically, right?

 

Edit: I think it was due to GNU_SOURCE being defined?

Developer
mreed
Posts: 1,041
Registered: ‎07-16-2008
My Device: ಠ_ಠ

Re: PThreads on Playbook

[ Edited ]