Hi All,
I have an application where I need to grab data from a high speed serial buffer. To process it in time I really do need to do something like the following:
Essentially start a thread that continually waits for data, collects it as it comes in, processes it in situ and then spits occasional data packets back to the GUI for display/control
I did have this run on a system.threading.timer but it randomly would cut out for 20-30 ms and my buffer overflowed.
Questions:
1) is this safe to let run for a long time? It seems like it would be safe. Just wondering if anyone had any experience, this application will be meant to run for weeks at a time.
2) Is there a better way to do this? Tasks, or the like?
Thanks in advance,
Nick
PS, not a traditional serial card so some of the built in .net handling of serial cards can't be used.
I have an application where I need to grab data from a high speed serial buffer. To process it in time I really do need to do something like the following:
Essentially start a thread that continually waits for data, collects it as it comes in, processes it in situ and then spits occasional data packets back to the GUI for display/control
I did have this run on a system.threading.timer but it randomly would cut out for 20-30 ms and my buffer overflowed.
Code:
Public Sub StartDataGrab()
CancelDataGrab = False
Dim Thread1 As New System.Threading.Thread(AddressOf doDataGrabs)
Thread1.Start()
End Sub
Public Sub doDataGrabs()
Do While Not CancelDataGrab
'Get data from Serial Buffer and Process
'Async send processed data back to GUI
'Run entire time UI thread is running
Loop
End Sub
1) is this safe to let run for a long time? It seems like it would be safe. Just wondering if anyone had any experience, this application will be meant to run for weeks at a time.
2) Is there a better way to do this? Tasks, or the like?
Thanks in advance,
Nick
PS, not a traditional serial card so some of the built in .net handling of serial cards can't be used.