diff options
author | Simon Haggett <simon.haggett@gmail.com> | 2019-06-13 17:00:17 +0100 |
---|---|---|
committer | Daiki Ueno <ueno@gnu.org> | 2019-06-14 12:54:41 +0200 |
commit | 5fc2d67b5ebb3daddb350d7ac60ede74dd99fcc6 (patch) | |
tree | 9521d41dea3c85db7ad888b88d6747bc7ed129c1 /build/certs/entrust-invalid.der | |
parent | c689917b393379d288b868f70b2f7b7f6aafe430 (diff) |
rpc: On UNIX wait on condition variable instead of FD if header is for a different thread.
If rpc_socket_read() receives a header for a different thread, it tries to yield by
releasing the read mutex and waiting on the socket's read FD. On Linux systems, this has
been observed to cause a performance problem in cases where multiple threads are being
used. Threads expecting a different header can rapidly unlock and relock the read mutex,
as they resume when sock->read_code hasn't changed. This can result in contention on the
read mutex, which delays the thread that is expecting to consume the header.
This fix updates rpc_socket_read() on UNIX to wait on a condition variable instead of the
socket's read FD. The condition variable is signalled when sock->read_code changes. This
allows waiting threads to only resume once the header and payload have been consumed by
their target thread. This fix only targets UNIX platforms, as the Windows version that
p11-kit targets by default (Windows 2000) does not provide support for condition
variables.
Signed-off-by: Simon Haggett <simon.haggett@gmail.com>
Diffstat (limited to 'build/certs/entrust-invalid.der')
0 files changed, 0 insertions, 0 deletions