In my application, I have used the number of System.Threading.Timer
and set this timer to fire every 1 second. My application execute the thread at every 1 second but it execution of the millisecond is different.
In my application i have used the OPC server & OPC group .one thread reading the data from the OPC server (like one variable changing it's value & i want to log this moment of the changes values into my application every 1 s) then another thread to read this data read this data from the first thread every 1s & second thread used for store data into the MYSQL database . in this process when i will read the data from the first thread then i will get the old data values like , read the data at 10:28:01.530 this second then i will get the information of 10:28:00.260 this second.so i want to mange these threads the first thread worked at 000 millisecond & second thread worked at 500 millisecond. using this first thread update the data at 000 second & second thread read the data at 500 millisecond.
My output is given below:
10:28:32.875 10:28:33.390 10:28:34.875 .... 10:28:39.530 10:28:40.875
However, I want following results:
10:28:32.000 10:28:33.000 10:28:34.000 .... 10:28:39.000 10:28:40.000
How can the timer be set so the callback is executed at "000 milliseconds"?