summaryrefslogtreecommitdiff
path: root/servers/audio
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2015-12-21 10:25:46 -0300
committerJuan Linietsky <reduzio@gmail.com>2015-12-21 10:25:46 -0300
commit49a19f85b8c49b891cdc2fdfaebce5e176c9b0c3 (patch)
tree37abb6111adabcd4ceb7b72a9f84fa78da3898cf /servers/audio
parent15429d6ac95acb044c9eebd64356f33e7e5d14ef (diff)
-different attempt to avod deadlock problem
Diffstat (limited to 'servers/audio')
-rw-r--r--servers/audio/audio_server_sw.cpp26
1 files changed, 18 insertions, 8 deletions
diff --git a/servers/audio/audio_server_sw.cpp b/servers/audio/audio_server_sw.cpp
index 3c55b10dac..47e4ccbf32 100644
--- a/servers/audio/audio_server_sw.cpp
+++ b/servers/audio/audio_server_sw.cpp
@@ -693,18 +693,28 @@ void AudioServerSW::stream_set_active(RID p_stream, bool p_active) {
Stream *s = stream_owner.get(p_stream);
ERR_FAIL_COND(!s);
+ _THREAD_SAFE_METHOD_
if (s->active==p_active)
return;
- AUDIO_LOCK;
- _THREAD_SAFE_METHOD_
- s->active=p_active;
- if (p_active)
- s->E=active_audio_streams.push_back(s);
- else {
- active_audio_streams.erase(s->E);
- s->E=NULL;
+ if (!thread || thread->get_ID()!=Thread::get_caller_ID()) {
+ //do not lock in mix thread
+ lock();
+ }
+ {
+ s->active=p_active;
+ if (p_active)
+ s->E=active_audio_streams.push_back(s);
+ else {
+ active_audio_streams.erase(s->E);
+ s->E=NULL;
+ }
+ }
+ if (!thread || thread->get_ID()!=Thread::get_caller_ID()) {
+ //do not lock in mix thread
+ unlock();
}
+
}
bool AudioServerSW::stream_is_active(RID p_stream) const {