AllenInstitute / MIES

Multichannel Igor Electrophysiology Suite
https://alleninstitute.github.io/MIES/user.html
Other
23 stars 7 forks source link

Pushing LNB wave references to threads results in recreation of keys wave #2223

Open MichaelHuth opened 2 months ago

MichaelHuth commented 2 months ago

Take NWB_AppendSweepDuringDAQ, where we duplicate the LNB waves for pushing them to a thread.

As the keys waves are not duplicated these are recreated on first LNB access in the thread each time.

But even if we duplicate the keys waves as well then the key that should detect changes in the LNB triggers a recreation because WaveModCounterWrapper returns a different value (NaN) for execution in a thread.

One solution would be to duplicate the keys waves as well (if present) and adapt the key to the value as it would be in the thread if the main thread key is valid.

t-b commented 2 months ago

That's unfortunately known. But right now this only wastes some time in the preemptive thread right?

MichaelHuth commented 2 months ago

Ok, but this is only one example of a more general problem as it also applies to all threadsafe functions that use caching and are used in a preemptive thread.

This is probably low priority.

One approach would be to duplicate the relevant caching waves such that we also push a partial cache to the thread. This would require to save some more info about the original vs. cache wave relation.