BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 09-02-2008, 01:28 PM   #1
Dan East
Thumbs Must Hurt
 
Join Date: Apr 2008
Model: 8130
PIN: N/A
Carrier: US Cellular
Posts: 82
Default Thread synchronization

Please Login to Remove!

Within my main thread I have a timer which fires multiple times per second, and invalidates the screen if there are active drawing jobs. I have a worker thread which spawns the drawing jobs at various times, then exits.

I want the worker thread to trigger an event in the main thread upon completion. Within Windows I would simply SendMessage something to my main thread's message handler, or I would have a loop in my main thread which checks for the desired event (WaitForSingleObject) while pumping messages to keep my UI alive (PeekMessage / DispatchMessage).

Obviously I can have my timer event check for something I set in my worker thread, but I don't want to go that route unless I have no other choice.

Is there a way to have the main thread wait for some event or other construct (mutex, etc) while still processing UI events? Or is there a way to trigger an event from a worker thread? I don't think invokeLater will work, because that is just single threaded, and my worker thread won't run concurrent to my timer events.

Thanks!
Offline  
Old 09-05-2008, 07:17 AM   #2
holy3daps
Thumbs Must Hurt
 
Join Date: Apr 2006
Location: Boston
Model: 8900
Carrier: AT&T
Posts: 98
Default

Check out net.rim.device.api.system.GlobalEventListener and net.rim.device.api.system.Application. You can set an object to be your application's GlobalEventListener, and handle "eventOccurred" methods that get sent to it, even from within your application. Also check out net.rim.device.api.system.ApplicationManager for the ability to post Global events.

Cheers,

karl
__________________
Karl G. Kowalski
---------------
Owns a RAZR
Develops for BlackBerry
So next phone will be........an iPhone 3G!
Offline  
Closed Thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


MKS Instrument Gauge Type 286 Thermocouple Vacuum Gauge  Stock #2763 picture

MKS Instrument Gauge Type 286 Thermocouple Vacuum Gauge Stock #2763

$280.00



1-15m S/R type thermocouple compensation wire silicone compensation cable picture

1-15m S/R type thermocouple compensation wire silicone compensation cable

$55.00



NEW  National Instruments NI 9213 cDAQ Temperature / Thermocouple Input Module picture

NEW National Instruments NI 9213 cDAQ Temperature / Thermocouple Input Module

$1530.00



Weidmuller 8432300000 WTS4 Thermocouple 24V picture

Weidmuller 8432300000 WTS4 Thermocouple 24V

$303.00



Cooking Performance Group Thermocouple 351302170058 picture

Cooking Performance Group Thermocouple 351302170058

$55.99



Tempco Mta01201 Thermocouple,Type J picture

Tempco Mta01201 Thermocouple,Type J

$101.99







Copyright © 2004-2016 BlackBerryForums.com.
The names RIM © and BlackBerry © are registered Trademarks of BlackBerry Inc.