Skip to content

Commit

Permalink
[Python] Use thread-safe futures for concurrent operations
Browse files Browse the repository at this point in the history
Instead of using quasi-global variables in the ChipStack singleton
use device controller local futures to store results from callbacks.
This has several advantages, namely:
- Avoid unnecessary shared state between device controllers
- Avoid unnecessary shared state between various operations within a
  device controller (those who don't share callbacks could be called
  from different threads now)
- Explicitly set Futures to None to detect spurious/unexpected callbacks
- Better code readability
- concurrent.futures are thread-safe
- Will make asyncio transition easier

This change shouldn't change the external API.
  • Loading branch information
agners committed Jun 13, 2024
1 parent 1a8c6d2 commit b551e51
Show file tree
Hide file tree
Showing 2 changed files with 162 additions and 160 deletions.
Loading

0 comments on commit b551e51

Please sign in to comment.