]> git.sesse.net Git - cubemap/commit
Reduce contention of queued_data_mutex.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sun, 8 Sep 2013 16:18:14 +0000 (18:18 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sun, 8 Sep 2013 16:18:14 +0000 (18:18 +0200)
commit9b8129d05b5d1ec0caed09a40f170e967afc60b3
treec8c2d4c47ce46e96f36186fea1111d929f843aa1
parent628e632811242333b1a88330c380ce48b8521fcb
Reduce contention of queued_data_mutex.

Seemingly holding queued_data_mutex over add_data_raw(), which does writev(),
could be slow on systems where /tmp is not on tmpfs, causing the queued_data_mutex
to be held for so long (up to a second has been observed) that the input thread
couldn't keep up.

To fix this, we move queued_data_mutex into a per-stream variable (not sure
if it's ideal, but it was the simplest way to avoid ugliness), and then hold it
for as short as possible in process_queued_data().

While we're at it, document that queued_data_last_starting_point has the same
locking rules as queued_data.
server.cpp
server.h
stream.cpp
stream.h