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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Contributor
Posts: 12
Registered: ‎09-18-2013
My Device: Z10
My Carrier: none

Re: Grand Central Dispatch

I will try, just to avoid the qthread **bleep** Smiley Very Happy

Developer
Posts: 1,524
Registered: ‎12-18-2012
My Device: Z30, Z10 LE, DevAlpha C, PlayBook

Re: Grand Central Dispatch

Hi,

 

QFuture concept is already very similar to GCD.

 

I think this can be done using QFutureWatcher. Connect to it's finished() signal:

http://developer.blackberry.com/native/reference/cascades/qfuturewatcher.html#details

There's also some sample code on the help page.

 

 


Andrey Fidrya, @zmeyc on twitter
Contributor
Posts: 12
Registered: ‎09-18-2013
My Device: Z10
My Carrier: none

Re: Grand Central Dispatch

yes, but its limited to signals like finished, no custom signals possible i guess...

not really what i need i think...

 

once again:

 

I start something in a background thread (kind of a daemon). from this thread i need to execute something in main

 

 

Developer
Posts: 828
Registered: ‎10-16-2012
My Device: Red Z10
My Carrier: Rogers

Re: Grand Central Dispatch

I also posted a github sample on using QTConcurrent to run tasks in a separate thread, It's nothing advanced but will get your toes wet

 

https://github.com/slashkyle/Cascades-Samples/tree/master/QtConcurrent

Contributor
Posts: 12
Registered: ‎09-18-2013
My Device: Z10
My Carrier: none

Re: Grand Central Dispatch

not usefull...

your thread is finished when updateLabel() is called, i need to communicate with main thread from a still running background thread
Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: Grand Central Dispatch

You can keep running around the issue but at some point you are going to have to bite the bullet. Smiley Happy

 

You need thread signalling and data passing, so use QThread with QMutex and QT signals & slots it does what you want and isn't that hard to implement.

 

If you want to wait for something exactly like GCD to be included in BB10 then you are welcome to do that too but you may be waiting a long time. Smiley Happy


If you've been helped click on Like Button, if you've been saved buy the app. Smiley Happy

Developer of stokLocker, Sympatico and Super Sentences.