mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 18:13:05 +02:00
Revert "avoid pessimizing audio slave lock contention"
This reverts commit 3508e71753
.
This commit is contained in:
parent
3508e71753
commit
eafbeb6d44
1 changed files with 13 additions and 12 deletions
|
@ -27,7 +27,7 @@ void AudioMixerSlaveThread::run() {
|
||||||
bool stopping = _stop;
|
bool stopping = _stop;
|
||||||
notify(stopping);
|
notify(stopping);
|
||||||
if (stopping) {
|
if (stopping) {
|
||||||
break;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -80,13 +80,14 @@ void AudioMixerSlavePool::mix(ConstIter begin, ConstIter end, unsigned int frame
|
||||||
_queue.emplace(node);
|
_queue.emplace(node);
|
||||||
});
|
});
|
||||||
|
|
||||||
// mix
|
|
||||||
_numStarted = _numFinished = 0;
|
|
||||||
_slaveCondition.notify_all();
|
|
||||||
|
|
||||||
// wait
|
|
||||||
{
|
{
|
||||||
Lock lock(_mutex);
|
Lock lock(_mutex);
|
||||||
|
|
||||||
|
// mix
|
||||||
|
_numStarted = _numFinished = 0;
|
||||||
|
_slaveCondition.notify_all();
|
||||||
|
|
||||||
|
// wait
|
||||||
_poolCondition.wait(lock, [&] {
|
_poolCondition.wait(lock, [&] {
|
||||||
assert(_numFinished <= _numThreads);
|
assert(_numFinished <= _numThreads);
|
||||||
return _numFinished == _numThreads;
|
return _numFinished == _numThreads;
|
||||||
|
@ -153,12 +154,12 @@ void AudioMixerSlavePool::resize(int numThreads) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ...cycle them until they do stop...
|
// ...cycle them until they do stop...
|
||||||
_numStopped = 0;
|
{
|
||||||
while (_numStopped != (_numThreads - numThreads)) {
|
Lock lock(_mutex);
|
||||||
_numStarted = _numFinished = _numStopped;
|
_numStopped = 0;
|
||||||
_slaveCondition.notify_all();
|
while (_numStopped != (_numThreads - numThreads)) {
|
||||||
{
|
_numStarted = _numFinished = _numStopped;
|
||||||
Lock lock(_mutex);
|
_slaveCondition.notify_all();
|
||||||
_poolCondition.wait(lock, [&] {
|
_poolCondition.wait(lock, [&] {
|
||||||
assert(_numFinished <= _numThreads);
|
assert(_numFinished <= _numThreads);
|
||||||
return _numFinished == _numThreads;
|
return _numFinished == _numThreads;
|
||||||
|
|
Loading…
Reference in a new issue