Skip to content

Commit

Permalink
Modbus Module runtime.lvclass: fix instance refcounting
Browse files Browse the repository at this point in the history
Fix for LabVIEW-DCAF#71.

modbus initialize API object.vi:
- New design assertions:
  1. Refcounts (Clients Count DVRs) are never closed.
  2. All API objects participate in refcounting, not just serial
     masters.
  This does not affect the behavior of things that aren't serial masters,
  and dramatically simplifies logic both here and in close.vi.
- Accordingly, the FGV variant now holds (Modbus API, refcount) tuples
  instead of (Modbus Master, refcount) tuples. And it is notionally getting
  indexed by (class, address) tuples, e.g. ("serial master", VISA
  instrument), or ("TCP master", IP address, port).

close.vi:
- Unwire "error in" from Decrement Clients Count.vi and the rest of that
  shutdown chain, to ensure that it always runs. This helps preserve normal
  close semantics for this VI.
- Remove Delete DVR call to Clients Count DVR, because modbus initialize API
  object.vi is now guaranteed to hold it open. Add a brief comment to this
  effect. Reorder final Merge Errors call accordingly.

Build lookup key for configuration.vi:
- Builds the strings of (class, address) tupes which are used to index into
  the FGV variant in modbus initialize API object.vi.

- "ok?" indicator controls whether or not reusing the modbus instance from
  the FGV is permitted -- false for everything but serial masters. (Refcount
  DVRs are always reused.)
  • Loading branch information
rtollert committed Aug 21, 2019
1 parent b984487 commit 74e66a6
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 0 deletions.
Binary file not shown.
Binary file modified source/module/execution/close.vi
Binary file not shown.
Binary file modified source/module/execution/modbus initialize API object.vi
Binary file not shown.

0 comments on commit 74e66a6

Please sign in to comment.