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
MauriceRice
Posts: 425
Registered: ‎03-17-2011
My Device: Developer
My Carrier: Telus
Accepted Solution

Thread example

Is there a (simple and easy-to-comprehend) example of running a process in a thread. I am a Java developer and I have read tons of documentation on c threads, but its pretty much greek to me and I don't know anything about what libraries are available on the PB. I coiuld use an example that works on the PlayBook.if such an animal exists.

_________________________
In the dark and need a sky map?
Discover What's up at App World.
Follow What's up on Facebook

Please use plain text.
Developer
BikeAtor
Posts: 62
Registered: ‎03-31-2012
My Device: Playbook
My Carrier: None

Re: Thread example

Are you using Qt? Then you could use QThread. Examples could be found everywhere. With normal NDK I don't know how todo it.

Please use plain text.
Developer
MauriceRice
Posts: 425
Registered: ‎03-17-2011
My Device: Developer
My Carrier: Telus

Re: Thread example


BikeAtor wrote:

Are you using Qt? Then you could use QThread. Examples could be found everywhere. With normal NDK I don't know how todo it.


Thanks. I need an example that will work with the "normal" NDK.. I am trying to write an ActionScript Native Extension (ANE) so I suppose it could be either c or c++ as long as it demonstrates usage of a threading library that is available on PlayBook.  I need to run the BPS sensor event loop in a thread so that it does not lock up  the main ANE threaqd.  As I said in the previous post I am an experienced Java developer and I am a complete novice when it comes to c.

_________________________
In the dark and need a sky map?
Discover What's up at App World.
Follow What's up on Facebook

Please use plain text.
Developer
BikeAtor
Posts: 62
Registered: ‎03-31-2012
My Device: Playbook
My Carrier: None

Re: Thread example

I'm also a java developer. So Qt and QtCreator are quite good for me. Qt ist easy to learn for a java guy.

Please use plain text.
BlackBerry Development Advisor
jhoffmann
Posts: 38
Registered: ‎10-26-2011
My Device: BlackBerry Bold 9900
My Carrier: Rogers

Re: Thread example

PlayBook uses POSIX standard pthreads. An internet search for 'pthreads' turns up a number of tutorials.
Please use plain text.
BlackBerry Development Advisor
jhoffmann
Posts: 38
Registered: ‎10-26-2011
My Device: BlackBerry Bold 9900
My Carrier: Rogers

Re: Thread example

The Channels Sample on GitHub shows a PlayBook app using pthreads.

 

NDK 2.0:

 

https://github.com/blackberry/NDK-Samples/tree/master/Channels

 

BB10 Beta:

 

https://github.com/blackberry/NDK-Samples/tree/next/Channels

 

Please use plain text.
Developer
MauriceRice
Posts: 425
Registered: ‎03-17-2011
My Device: Developer
My Carrier: Telus

Re: Thread example


BikeAtor wrote:

I'm also a java developer. So Qt and QtCreator are quite good for me. Qt ist easy to learn for a java guy.


This may be true but it doesn't help me in this particular situation. I am not looking for a general-purpose app framework. Rather I am writing an extension for my Air app and whatever I use must coexist with the Adobe-provided API. QT may very well work if ihas a standalone native threading library and if you can tell me how to use it in my.native extension. 

_________________________
In the dark and need a sky map?
Discover What's up at App World.
Follow What's up on Facebook

Please use plain text.
Developer
MauriceRice
Posts: 425
Registered: ‎03-17-2011
My Device: Developer
My Carrier: Telus

Re: Thread example

[ Edited ]

jhoffmann wrote:
PlayBook uses POSIX standard pthreads. An internet search for 'pthreads' turns up a number of tutorials.

Thanks, this is the information that I need. I'll have a look.

 

Edit: I found a good tutorial on pthreads here:along with some examples:

https://computing.llnl.gov/tutorials/pthreads/#PthreadsAPI

 

_________________________
In the dark and need a sky map?
Discover What's up at App World.
Follow What's up on Facebook

Please use plain text.
New Developer
meetlesli
Posts: 11
Registered: ‎06-25-2014
My Device: BB
My Carrier: Vodafone

Re: Thread example

thanks for ur help ,myproblem is sovled.


java example

Leslie Love
Please use plain text.