modbus-tk icon indicating copy to clipboard operation
modbus-tk copied to clipboard

The global lock can be replaced by `self.lock` in `Master.execute`

Open sazima opened this issue 2 years ago • 0 comments

https://github.com/ljean/modbus-tk/blob/c168f7158abd16d487046eaecb2aa49bf863d9dd/modbus_tk/modbus.py#L137

In my project, I need to read more than a dozen PLCs and each Plc needs to read 60 address. When I read one PLC, it is not necessary for the other Plc to wait for lock.

In my test: When use @threadsafe_function call execute cost more than 20 seconds every time . Use with self.lock: takes only cost less than 1 seconds

sazima avatar Apr 09 '22 03:04 sazima