Skip to content

Commit

Permalink
modified integration test to access datastore within a lock
Browse files Browse the repository at this point in the history
  • Loading branch information
sjalex committed May 26, 2009
1 parent 643b377 commit c99191a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion NModbus/src/Modbus.IntegrationTests/ModbusMasterFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -260,11 +260,16 @@ public virtual void ExecuteCustomMessage_Foobar()
{
delegateExectuted = true;
// get data from data store, make sure to access within a lock to respect multi threaded access
ushort[] data;
lock (dataStore.SyncRoot)
data = dataStore.HoldingRegisters.Slice(request.StartAddress, request.NumberOfPoints).ToArray();
return new CustomFoobarResponse
{
SlaveAddress = request.SlaveAddress,
ByteCount = 4,
Data = dataStore.HoldingRegisters.Slice(request.StartAddress, request.NumberOfPoints).ToArray()
Data = data
};
});

Expand Down

0 comments on commit c99191a

Please sign in to comment.