diff options
author | Gerhard Sittig <gerhard.sittig@gmx.net> | 2020-07-18 13:15:41 +0200 |
---|---|---|
committer | Gerhard Sittig <gerhard.sittig@gmx.net> | 2020-07-18 15:48:50 +0200 |
commit | f8c62753bc30432ef48c00d055551b33121b5535 (patch) | |
tree | f53729ce5b7e7b3bc56cb8a6fe21f947e521fa86 /decoders/ir_nec | |
parent | 8c3291c74998bddac4b355d2ffbaf94e22bad3a7 (diff) | |
download | libsigrokdecode-f8c62753bc30432ef48c00d055551b33121b5535.tar.gz libsigrokdecode-f8c62753bc30432ef48c00d055551b33121b5535.zip |
ir_irmp: enforce "one instance" limitation for IRMP library
The IRMP core library is not prepared for threading or interleaved use
by multiple call sites for different data streams, internal state is
kept in global vars (MCU project heritage). Adjust the Python wrapper,
create one usable instance, and several more which fail to execute.
Fail late such that users see error messages.
The approach isn't pretty, but avoids segfaults when re-loaded sessions
assign multiple decoder instances, and raises user's awareness of the
"one instance" limitation by established means: "decoder error" bar, and
log messages, with a description to point out the cause.
This commit implements a dirty modification of a singleton. It's a pity
that Python appears to lack reliable destruction, hence the whole class
remains blocked even if the instance is released. Move all library use
into pd.py:decode() in the hope that Python's 'with' could help in a
future implementation. Prepare to either present a generic message that
is generated by pd.py, or pass on a text that originates in the Python
wrapper for the C library.
Diffstat (limited to 'decoders/ir_nec')
0 files changed, 0 insertions, 0 deletions