heroes88 / nmodbus

Automatically exported from code.google.com/p/nmodbus
0 stars 0 forks source link

Lock required in ModbusTransport UnicastMessage<T>(IModbusMessage message) #32

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. A multi-threaded application sharing a single ModbusMaster object.
2.
3.

What is the expected output? What do you see instead?
It is possible that the command requests and responses get mixed up when
multiple threads are sending messages at the same time.

What version of the product are you using? On what operating system?
Latest trunk revision 231, Visual Studio 2008, Windows XP

Please provide any additional information below.
A simple lock around the body of the UnicastMessage method is sufficient to
ensure that the ModbusTransport is locked until an entire message (request
and response) is complete.

Original issue reported on code.google.com by mccle...@googlemail.com on 11 Jun 2008 at 1:45

GoogleCodeExporter commented 8 years ago
There is additional work required to make a ModbusTransport thread safe, 
however this
is an easy improvement and covers most major cases.

Original comment by sja...@gmail.com on 13 Jun 2008 at 9:36