Connecting Tech Pros Worldwide Help | Site Map

any potential threading error?

  #1  
Old June 2nd, 2009, 06:49 PM
Newbie
 
Join Date: Oct 2007
Location: USA
Posts: 15
I'm thinking of creating simple test program, but before I jump to coding I would like to ask so I can hopefully avoid any tricky threading bug.

I plan to have a GUI and will have its own thread.

I also want to have a backgroundworker thread to keep checking for the connection between desktop and device. In that thread, I may have timer for periodically checking maybe every half of second to see if connection is still good. The connection will be with USB cable through ActiveSync. This backgroundworker thread will never stop running until exiting out the application.

I would like to have another thread, but I don't know what kind of thread should I use. Should I use backgroundworker thread or simply just Thread. This third thread mainly runs the test process. This thread will stop when finish running all the test process.

In my test program, every time when the connection lost, it will pause the test thread to stop running the test process. For me to that, maybe I should let my backgroundworker thread to call to the GUI thread then the GUI thread will stop the test thread until backgroundworker thread notifies connection is good.

Are these considered as safe approach?

thanks.
  #2  
Old June 2nd, 2009, 07:00 PM
tlhintoq's Avatar
Moderator
 
Join Date: Mar 2008
Location: Arizona, USA
Posts: 1,692
Provided Answers: 3

re: any potential threading error?


Quote:
I also want to have a backgroundworker thread to keep checking for the connection between desktop and device.
Is it necessary to poll for the device. Doesn't ActiveSync raise an event when a device connects or disconnects?
  #3  
Old June 2nd, 2009, 07:10 PM
Newbie
 
Join Date: Oct 2007
Location: USA
Posts: 15

re: any potential threading error?


I'm not sure if it's necessary but I thought it would be nice to keep monitoring to update text information to the GUI about the connection status. I'm not planing to use ActiveSync functions, but I may use an open source wraper RAPI.

thanks you for your suggestion and thanks for moving the post to here because I was unable to create new post in other byte forums..
  #4  
Old June 4th, 2009, 02:35 AM
NeoPa's Avatar
Administrator
 
Join Date: Oct 2006
Location: London - UK
Posts: 15,450
Provided Answers: 56

re: any potential threading error?


Quote:
Originally Posted by winningElevent View Post
... because I was unable to create new post in other byte forums..
Check out HELP! My ACCOUNT is DISABLED!
Reply


Similar Threads
Thread Thread Starter Forum Replies Last Post
Error with TreeView Control (MSCOMCTL.OCX) via COM Interop from ASP.NET and Service Pack MarkD answers 0 November 19th, 2005 05:03 PM
Threading with UI elements - dynamically created controls? RCS answers 13 November 16th, 2005 08:03 PM
Threading with UI elements - dynamically created controls? RCS answers 0 November 16th, 2005 07:58 PM
Need some help with Python/C api and threading Steve Menard answers 7 July 18th, 2005 01:23 PM