mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-15 17:25:06 +00:00
one more race condition fix
This commit is contained in:
parent
80927b80b1
commit
6050fc7208
1 changed files with 6 additions and 0 deletions
|
@ -614,9 +614,11 @@ void DivEngine::createNew(const int* description) {
|
||||||
void DivEngine::changeSystem(int index, DivSystem which) {
|
void DivEngine::changeSystem(int index, DivSystem which) {
|
||||||
quitDispatch();
|
quitDispatch();
|
||||||
isBusy.lock();
|
isBusy.lock();
|
||||||
|
saveLock.lock();
|
||||||
song.system[index]=which;
|
song.system[index]=which;
|
||||||
song.systemFlags[index]=0;
|
song.systemFlags[index]=0;
|
||||||
recalcChans();
|
recalcChans();
|
||||||
|
saveLock.unlock();
|
||||||
isBusy.unlock();
|
isBusy.unlock();
|
||||||
initDispatch();
|
initDispatch();
|
||||||
isBusy.lock();
|
isBusy.lock();
|
||||||
|
@ -637,11 +639,13 @@ bool DivEngine::addSystem(DivSystem which) {
|
||||||
}
|
}
|
||||||
quitDispatch();
|
quitDispatch();
|
||||||
isBusy.lock();
|
isBusy.lock();
|
||||||
|
saveLock.lock();
|
||||||
song.system[song.systemLen]=which;
|
song.system[song.systemLen]=which;
|
||||||
song.systemVol[song.systemLen]=64;
|
song.systemVol[song.systemLen]=64;
|
||||||
song.systemPan[song.systemLen]=0;
|
song.systemPan[song.systemLen]=0;
|
||||||
song.systemFlags[song.systemLen++]=0;
|
song.systemFlags[song.systemLen++]=0;
|
||||||
recalcChans();
|
recalcChans();
|
||||||
|
saveLock.unlock();
|
||||||
isBusy.unlock();
|
isBusy.unlock();
|
||||||
initDispatch();
|
initDispatch();
|
||||||
isBusy.lock();
|
isBusy.lock();
|
||||||
|
@ -662,12 +666,14 @@ bool DivEngine::removeSystem(int index) {
|
||||||
}
|
}
|
||||||
quitDispatch();
|
quitDispatch();
|
||||||
isBusy.lock();
|
isBusy.lock();
|
||||||
|
saveLock.lock();
|
||||||
song.system[index]=DIV_SYSTEM_NULL;
|
song.system[index]=DIV_SYSTEM_NULL;
|
||||||
song.systemLen--;
|
song.systemLen--;
|
||||||
for (int i=index; i<song.systemLen; i++) {
|
for (int i=index; i<song.systemLen; i++) {
|
||||||
song.system[i]=song.system[i+1];
|
song.system[i]=song.system[i+1];
|
||||||
}
|
}
|
||||||
recalcChans();
|
recalcChans();
|
||||||
|
saveLock.unlock();
|
||||||
isBusy.unlock();
|
isBusy.unlock();
|
||||||
initDispatch();
|
initDispatch();
|
||||||
isBusy.lock();
|
isBusy.lock();
|
||||||
|
|
Loading…
Reference in a new issue