connections: Set up thread pool for handling client requests
commit21caa167339cf4b3e280718853fefaaef6ad3bcb
authorEric Blake <eblake@redhat.com>
Thu, 16 Nov 2017 03:25:05 +0000 (15 21:25 -0600)
committerEric Blake <eblake@redhat.com>
Mon, 20 Nov 2017 20:06:58 +0000 (20 14:06 -0600)
tree71d81d5cef075dff9225968e3220521d2dfd9b93
parent0e1f158a1aee18c33f0d5634a622077aa230d600
connections: Set up thread pool for handling client requests

Finish plumbing up everything we will need to process multiple
client requests in parallel after handshake is complete. Since
status is now global, and properly protected by a mutex, all
of the threads will eventually quit as soon as any of them
notices EOF or nbdkit detects a signal.

For ease of review, the framework for configuring threads is
done separately from the low-level work of utilizing the threads,
so this patch sees no behavior change (because we hard-code
conn->nworkers to 0); although it's a one-line hack to test that
a larger nworkers still behaves the same even for a non-parallel
plugin (in fact, such a hack was how I found and squashed several
thread-safety bugs in the previous patches, exposed from running
test-socket-activation in a loop).

Signed-off-by: Eric Blake <eblake@redhat.com>
src/connections.c