Skip to content

Verify/Fix Resource Management #35

@rneswold

Description

@rneswold

Issue #34 brings up a point that we may have been cleaning up our resources in the wrong location. This issue was created to track either fixing the problem or verifying it has the proper behavior. Mostly I want to verify correct behavior for the 1.x branch since that's the future of this package. These are the specifications we should meet:

  • async with DPMContext() will create a connection to a DPM. The state of that connection is maintained by the object returned in the statement (typically we call it dpm). Once this block is exited, all DPM resources are freed.
  • async for ... starts delivering pending and new packets from DPM. If this loop is exited, DPM acquisition should stop. Maybe entering an async for-loop should do an underlying dpm.start() and exiting should do dpm.stop()? At any rate, leaving the loop shouldn't harm the connection state.
  • When dpm.stop() is called, the STOP command sent to DPM must have a reply so we know DPM won't send anymore data. Then the library should clear out any pending data so that when a new async for-loop is started, the data returned is guaranteed to be new.

This allows a script to enter an acquisition loop, leave it to do other stuff, and then enter another one. The DPM flow should start and stop at the appropriate time.

Metadata

Metadata

Assignees

Labels

discussionissue requires discussion

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions