DrMemCS / drmem

Full source tree for the DrMem control system
MIT License
3 stars 4 forks source link

:zap: Add concurrency to logic block body #88

Open rneswold opened 1 year ago

rneswold commented 1 year ago

The main loop of a logic block body is

The problem is that any generated settings are serialized. This loop should build a vector of futures that send the setting and, after all expressions have been processed, resolve the vector of futures at once. If one target device is a little slow, it won't necessarily slow down other devices.

(Of course, this only improves the behavior of logic blocks that have more than one expression.)

rneswold commented 9 months ago

Turns out this is more difficult than I thought.

I tried to build a vector of futures which could be run concurrently, but couldn't fix the compile errors. In order to send the outgoing settings, the vector of futures captured some data from self. I think the core of the run() method needs to refactored. Maybe the output channels need to be stored as local variables of run() instead of instance fields of Node?

rneswold commented 2 months ago

This issue is blocked until #89 is finished. There's a risk that, if this was completed first, it would need further work once the other issue was completed.