]> sigrok.org Git - libsigrokdecode.git/commitdiff
Acquire/release the Python GIL where needed to avoid threading issues.
authorUwe Hermann <redacted>
Wed, 28 Jun 2017 20:29:06 +0000 (22:29 +0200)
committerUwe Hermann <redacted>
Fri, 30 Jun 2017 11:05:09 +0000 (13:05 +0200)
With these additions, frontends can now call libsigrokdecode API
functions from different threads without running into threading issues.

The backend releases the GIL when it is performing tasks that might take
a while and it doesn't need to run Python/C API calls during that time.

This allows frontends to run multiple PD stacks (in multiple frontend
threads) "at the same time" in a time-sharing, "interlocked" manner.
Whenever one of the decoders is inside e.g. self.wait() it releases the
GIL and thus allows other decoders to do some work in the mean time.

The user-visible effect is that for use-cases such as running 3 different
decoder stacks at the same time for an acquisition, the user will not
have to wait for PD 1 to finish decoding, then wait for PD 2 to finish
decoding, and only *then* being able to see annotations from PD 3.

Instead, all three PDs will decode some chunks of data from time to
time, thus the user is able to inspect annotations from all 3 PDs while
the acquisition and decoding is still going on.


No differences found