is a Thread suitable for this app?
Hello,
I was wondering if to use threads could be the good solution to the following problem.
I would like to developt a dialog based application that sends Data (A canbus message similar to RS232 but instead to a Canbus Network) when I push a bottom. I want also to send this message periodically (each 100 ms) when a box is checked. I have my application running OK with the push buttom but I want to add the periodic sending of Canbus messages feature.
I have read about Threads and I would like to ask you if a worker thread that do Sleep(100) and then post a message to the GUI in order to the GUI execute the same function as when the buttom is pushed could be a good solution or maybe is there something more suitable?. I am very new to Visual c++ so I don't know all the possibilies that I could use for solving this at the moment.
Thanks a lot and best regards,
Javo
Re: is a Thread suitable for this app?
Quote:
Originally posted by javo
when I push a bottom
Quote:
Originally posted by javo
when a box is checked
Quote:
Originally posted by javo
the GUI execute the same function as when the buttom is pushed
This is confusing for me. The button is (part of) the GUI.
Regardlous, the question of whether to use threads depends essentially on whether there is an asychronous event that needs to be processed. If sending the data can be done sequentially without waiting for something, and if sending the data will not require a lot of time, then there is no need for a thread. A timer would be used to send the data periodically as needed.