lnls-dig / halcs

Hardware Abstraction Layer for Control Systems
GNU General Public License v3.0
1 stars 4 forks source link

[hal] How to protect multiple clients access to the same DEVIO? #7

Open lerwys opened 8 years ago

lerwys commented 8 years ago

Issue by lerwys Wednesday May 28, 2014 at 12:03 GMT Originally opened as https://github.com/lerwys/bpm-software-old-bakcup/issues/7


Problem: Imagine a scenario where multiple clients access (i.e., requests) the same DEVIO instance, being the same SMIO or not. For operations that work in 2 or more messages, like the acquisition, there could be a concurrency issue in that different clients request an acquisition with different parameters (by means of the data_aquire () function).

In this state, currently, there is no way to be sure that subsequently calls to get_data_block (), will return data relative to the respective data_aquire () parameters. Of course, if the a second data_aquire () requests less samples than the first one, and the first client requests for a certain block of data, invalid blocks will still be reported to the client correctly, but that wouldn't make sense, as the client specifically requested for more samples.

Solution: There are various approaches that could be taken, two of them are: