Re: Thread related design advice please

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance




Could I use two forms timers, one to handle the DB query and one to handle
the UI update ?

If I take this approach I would assume I would still need to perform some
thread safety around the saving and retrieving of records ?

ie Thread 1 updates retrieves DB records and saves them away in the 'queue',
thread two reads from the 'queue' at set intervals and updates the ui ?

.........confused......

Jon




"Bishman" <jonathan.bishop@xxxxxxxxxxxxxx> wrote in message
news:eAHUBxn1GHA.1588@xxxxxxxxxxxxxxxxxxxxxxx
Hi,

I have a form application that needs to query a DB at a set timed interval
and then refresh the form with values received from the DB. Simple enough.

My design releated questions are ....

Should I create a worker thread that encapsulates a timer, (which I
believe will also create a seperate thread when the timer fires) , or
should I create a timer that creates a new thread when it fires ? Or
neither ?

Which sort of timer should I use. "System.Timers.Timer" or
"System.Windows.Forms.Timer"

I was going to 'place' the results of the DB query into a queue of some
sort that can then be retrieved at a set interval ( another timer ? ) and
display them on the form. How do I make this queue threadsafe ?

Some general design pointers would be appreciated.

Thanks.
Jon.



.



Relevant Pages

  • Re: Lahman, how ya doing?
    ... Object* recipient; int event_id; ... Timer ... Not relevant to my simulation, but generalizing to a case where any amount of time can pass between when an event is pushed on to the queue and when it is popped off and processed, it seems you can have two identical events going to the same object. ... given tick. ...
    (comp.object)
  • Re: Lahman, how ya doing?
    ... >things like Thermometer, Computer, Filter, Beam, etc. for objects. ... >> control blocks from. ... >Is Timer a true event generator? ... >queue structure. ...
    (comp.object)
  • Re: Lahman, how ya doing?
    ... >> A priority queue is an interesting idea. ... So Timer just enqueues the event on the right queue. ... >effectively starts at the same time on the current tick. ... >was triggered just gets time-sliced based on priority. ...
    (comp.object)
  • Re: Lahman, how ya doing?
    ... Object* recipient; int event_id; ... Timer ... Not relevant to my simulation, but generalizing to a case where any amount of time can pass between when an event is pushed on to the queue and when it is popped off and processed, it seems you can have two identical events going to the same object. ... given tick. ...
    (comp.object)
  • Re: Threading - Is this Ok?
    ... with the web part showing status updates until it's finished.. ... panel using a Timer control. ... simultaneous users and the code takes 100 seconds to execute. ... I think you can put Status into Session state and pass Session to a ...
    (microsoft.public.dotnet.languages.csharp)