Connecting Tech Pros Worldwide Forums | Help | Site Map

any potential threading error?

Newbie
 
Join Date: Oct 2007
Location: USA
Posts: 15
#1: Jun 2 '09
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.

tlhintoq's Avatar
Moderator
 
Join Date: Mar 2008
Location: Arizona, USA
Posts: 1,777
#2: Jun 2 '09

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?
Newbie
 
Join Date: Oct 2007
Location: USA
Posts: 15
#3: Jun 2 '09

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..
NeoPa's Avatar
Administrator
 
Join Date: Oct 2006
Location: London - UK
Posts: 15,729
#4: Jun 4 '09

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