0

for university I wrote an uart serial comport reader that reads packages into a big list of size N(300ish) of type T(class with data and some functions). The list is created on startup from a json, and then the new information from updates the results. The first byte is basically the 'channel/databaseentry' of where in the list this value should be processed.

the basic readpackage function looks like this:

void handlePackage(byte[] package)
{
        // update results in database
        WriteToDatabase(package[0], package 1 to end);

        // Save to daq
        SaveCh(package[0]);
}

I added a data acquisition tool that basically records any package in the form of DeltaTime (time since last package to this channel) + processed value.

list<short>[x] dT {5000, 314, 50, 200 ... }
list<double[x] val {40, -5, 6.7 300 .. }

meaning for entry X: after 5000ms the value 40 was read, then 314ms later it turns -5 etc..

So I basically have around 300+300 lists that have the timings to update the database, how can I merge all these lists into some async function that would act like a replay similar to the uart comport reader?

I'd think 300 threads is a bit overkill?

0 Answers0