diff options
| author | Carl Hetherington <cth@carlh.net> | 2024-05-08 01:53:50 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2024-05-08 01:53:50 +0200 |
| commit | 6b2119dcd16c43fd681feace00d4e10f464bb9b7 (patch) | |
| tree | 50ac586ce4aac6d85c98084ddccd47d4c61ed315 /src/lib/j2k_encoder.cc | |
| parent | 29f773b4871511a686054bfcd4d769c3707907f6 (diff) | |
| parent | 32d04ddb5c583938f470ed74bda8a50cc2ec9960 (diff) | |
Merge remote-tracking branch 'origin/main' into v2.17.x
Diffstat (limited to 'src/lib/j2k_encoder.cc')
| -rw-r--r-- | src/lib/j2k_encoder.cc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/lib/j2k_encoder.cc b/src/lib/j2k_encoder.cc index 094e104ef..0b50bcd5a 100644 --- a/src/lib/j2k_encoder.cc +++ b/src/lib/j2k_encoder.cc @@ -108,6 +108,16 @@ J2KEncoder::~J2KEncoder () { _server_found_connection.disconnect(); + /* One of our encoder threads may be waiting on Writer::write() to return, if that method + * is blocked with the writer queue full waiting for _full_condition. In that case, the + * attempt to terminate the encoder threads below (in terminate_threads()) will fail because + * the encoder thread waiting for ::write() will have interruption disabled. + * + * To work around that, make the writer into a zombie to unblock any pending write()s and + * not block on any future ones. + */ + _writer.zombify(); + terminate_threads(); #ifdef DCPOMATIC_GROK @@ -153,6 +163,8 @@ J2KEncoder::pause() } return; + /* XXX; the same problem may occur here as in the destructor, perhaps? */ + terminate_threads (); /* Something might have been thrown during terminate_threads */ |
