]> sigrok.org Git - libsigrokdecode.git/commit - libsigrokdecode.h
session: introduce the public "send EOF" API routine
authorGerhard Sittig <redacted>
Sun, 26 Dec 2021 06:42:27 +0000 (07:42 +0100)
committerGerhard Sittig <redacted>
Sun, 26 Dec 2021 12:45:09 +0000 (13:45 +0100)
commit819e508972da02a0dcff7f81178f0283546a9afd
tree5a48cb02cf7b712e2d152e547b7fab6ab969c8dd
parent487890c822762d9886dfd022ed599c9909ceaab9
session: introduce the public "send EOF" API routine

Introduce the public srd_session_send_eof() routine which is backed by
the internal srd_inst_send_eof() helper. Applications can tell decoders
when the input stream of sample data is exhausted, so that decoders can
optionally "flush" their previously accumulated information when
desired. Previous implementations just kept decoders in blocking .wait()
calls and somehow terminated them at arbitrary times afterwards.

When EOF is sent to the decoder session, then calls to the .wait()
method which typically are done from .decode() or its descendents will
end with an EOFError Python exception. Termination of .decode() with the
EOFError exception is non-fatal for backwards compatibility and to keep
the convenience for current decoder implementations. Decoders can either
catch the exception, or use context managers, or do nothing.

This API extension is motivated by research for bug #1581 and provides
the infrastructure to address bug #292. Decoders need to remain careful,
and should not claim that protocol activities would have completed when
their end condition was not even seen in the capture. Marking incomplete
activities with warnings is the most appropriate reaction.
instance.c
libsigrokdecode-internal.h
libsigrokdecode.h
session.c
type_decoder.c