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) {
|
||||
quitDispatch();
|
||||
isBusy.lock();
|
||||
saveLock.lock();
|
||||
song.system[index]=which;
|
||||
song.systemFlags[index]=0;
|
||||
recalcChans();
|
||||
saveLock.unlock();
|
||||
isBusy.unlock();
|
||||
initDispatch();
|
||||
isBusy.lock();
|
||||
|
@ -637,11 +639,13 @@ bool DivEngine::addSystem(DivSystem which) {
|
|||
}
|
||||
quitDispatch();
|
||||
isBusy.lock();
|
||||
saveLock.lock();
|
||||
song.system[song.systemLen]=which;
|
||||
song.systemVol[song.systemLen]=64;
|
||||
song.systemPan[song.systemLen]=0;
|
||||
song.systemFlags[song.systemLen++]=0;
|
||||
recalcChans();
|
||||
saveLock.unlock();
|
||||
isBusy.unlock();
|
||||
initDispatch();
|
||||
isBusy.lock();
|
||||
|
@ -662,12 +666,14 @@ bool DivEngine::removeSystem(int index) {
|
|||
}
|
||||
quitDispatch();
|
||||
isBusy.lock();
|
||||
saveLock.lock();
|
||||
song.system[index]=DIV_SYSTEM_NULL;
|
||||
song.systemLen--;
|
||||
for (int i=index; i<song.systemLen; i++) {
|
||||
song.system[i]=song.system[i+1];
|
||||
}
|
||||
recalcChans();
|
||||
saveLock.unlock();
|
||||
isBusy.unlock();
|
||||
initDispatch();
|
||||
isBusy.lock();
|
||||
|
|
Loading…
Reference in a new issue