I've posted some of these patches or ideas before; but now I'm confident enough with the series that it should be ready to push; at any rate, I can now run test-socket-activation in a tight loop without triggering any crashes or hangs. With this in place, I'm going back to work on making the nbd forwarder wort with the parallel thread model. Eric Blake (8): sockets: Use pipe-to-self to avoid hanging in poll cleanup: Add ACQUIRE_LOCK_FOR_CURRENT_SCOPE() connections: Add read/write lock over client I/O connections: Add thread-safe status indicator connections: Set up thread pool for handling client requests core: Add --threads option for supporting true parallel requests tests: Annotate Makefile.am conditionals tests: Test parallel behavior TODO | 7 - configure.ac | 11 +- docs/nbdkit.pod | 12 +- nbdkit.in | 2 +- plugins/file/file.c | 2 +- src/cleanup.c | 8 +- src/connections.c | 316 ++++++++++++++++++++++++++++++-------------- src/internal.h | 14 +- src/main.c | 39 +++++- src/plugins.c | 8 ++ src/sockets.c | 14 +- tests/Makefile.am | 55 +++++--- tests/test-parallel-file.sh | 71 ++++++++++ 13 files changed, 414 insertions(+), 145 deletions(-) create mode 100755 tests/test-parallel-file.sh -- 2.13.6