posted on Jul, 1 2021 @ 01:10 PM
a reply to:
dug88
I am looking for a language that has built in thread safety.
what I am on to:
I have ton's of driving data from different sources that I want to equalize / stream in a clocked manner because I want to overlay it on video. I just
don't have any widgets or panels so until now I process all the data and draw it on bitmaps, replace those bitmaps via timer that is setup to trigger
every frame of the video.
The problem is, every dataset isn't equalized to the same sample rate. I get RPM values six times more often than let's say the speed calculated from
the GPS data. I've tried to just ignore this issue and hoped it would all look seamless in the video but I still can not test it.
I use c# for this one and self built timer class from System.Threading.Timer (may not be the actual namespace) that doesn't fire in a fixed interval
but tries to adapt to the time lost. So I store the DATETIME in a variable and then calculate the next firing DATETIME, check several times in between
and adjust the sleep(). Statistics show it is very close to the timeframe I need to make it all fluid on screen.
I thought about using more than fourty (40) individual timers too, one for each sample rate but wanted it to be self managing. Maybe that's to big of
a bite. On top if it, I run into threading issues and at some point, it all crashes.
VS then tells me that at some point, my program tried to re-instanciate itself (WTF) and thus crashes because there can only be one instance of the
starting FORM-class. I also get the infamous red-cross in white space occasionally. Sporadically, there's nothing I see that triggers it. It happens
at the freakiest times even with 1:1 data reused for hundred times, sometimes it just goes broke.
I am up to my ears in trouble lol.
edit on 1.7.2021 by ThatDamnDuckAgain because: up TO my ears, not up IN my ears..
edit on
1.7.2021 by ThatDamnDuckAgain because: (no reason given)