Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntony Riakiotakis <kalast@gmail.com>2015-01-28 21:45:16 +0300
committerAntony Riakiotakis <kalast@gmail.com>2015-01-28 21:45:29 +0300
commit773d85ab320b0a115ef23321435649e1a8a1ef63 (patch)
tree265efab63d8f46ce971262229ff53c5e4992dd83 /source/blender/blenkernel/intern/sound.c
parent424100cecbb202004e1687d5066b2c88e7a58f58 (diff)
Based on Sergey's suggestion, use spinlocks for threaded loading of
waveforms.
Diffstat (limited to 'source/blender/blenkernel/intern/sound.c')
-rw-r--r--source/blender/blenkernel/intern/sound.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c
index 43daaf2120c..25ac3c91b7f 100644
--- a/source/blender/blenkernel/intern/sound.c
+++ b/source/blender/blenkernel/intern/sound.c
@@ -118,9 +118,10 @@ void BKE_sound_free(bSound *sound)
sound_free_waveform(sound);
- if (sound->mutex) {
- BLI_mutex_free(sound->mutex);
- sound->mutex = NULL;
+ if (sound->spinlock) {
+ BLI_spin_end(sound->spinlock);
+ MEM_freeN(sound->spinlock);
+ sound->spinlock = NULL;
}
#endif /* WITH_AUDASPACE */
@@ -709,18 +710,18 @@ void sound_read_waveform(bSound *sound, short *stop)
MEM_freeN(waveform->data);
}
MEM_freeN(waveform);
- BLI_mutex_lock(sound->mutex);
+ BLI_spin_lock(sound->spinlock);
sound->flags &= ~SOUND_FLAGS_WAVEFORM_LOADING;
- BLI_mutex_unlock(sound->mutex);
+ BLI_spin_unlock(sound->spinlock);
return;
}
sound_free_waveform(sound);
- BLI_mutex_lock(sound->mutex);
+ BLI_spin_lock(sound->spinlock);
sound->waveform = waveform;
sound->flags &= ~SOUND_FLAGS_WAVEFORM_LOADING;
- BLI_mutex_unlock(sound->mutex);
+ BLI_spin_unlock(sound->spinlock);
}
void sound_update_scene(Main *bmain, struct Scene *scene)