Dear Jack2 Maintainers,
I have a question about JackAudioDriver.cpp. It seems to me like there could be a possible
race condition in JackAudioDriver::ProcessGraphSyncMaster(), where the driver would do
read and write on a slave device without waiting for graph execution end.
Below is the proposed "fix", or what I would expect is correct, am I reading
something wrong in the code? What do you guys think?
diff --git a/common/JackAudioDriver.cpp b/common/JackAudioDriver.cpp
index ef7c683..9172fe8 100644
--- a/common/JackAudioDriver.cpp
+++ b/common/JackAudioDriver.cpp
@@ -327,16 +327,12 @@ void JackAudioDriver::ProcessGraphSyncMaster()
// fBeginDateUst is set in the "low level" layer, fEndDateUst is from
previous cycle
if (fEngine->Process(fBeginDateUst, fEndDateUst)) {
- if (ResumeRefNum() < 0) {
- jack_error("JackAudioDriver::ProcessGraphSyncMaster: ResumeRefNum
error");
- }
-
if (ProcessReadSlaves() < 0) {
jack_error("JackAudioDriver::ProcessGraphSync: ProcessReadSlaves error,
engine may now behave abnormally!!");
}
- if (ProcessWriteSlaves() < 0) {
- jack_error("JackAudioDriver::ProcessGraphSync: ProcessWriteSlaves error,
engine may now behave abnormally!!");
+ if (ResumeRefNum() < 0) {
+ jack_error("JackAudioDriver::ProcessGraphSyncMaster: ResumeRefNum
error");
}
// Waits for graph execution end
@@ -344,6 +340,10 @@ void JackAudioDriver::ProcessGraphSyncMaster()
jack_error("JackAudioDriver::ProcessGraphSync: SuspendRefNum error,
engine may now behave abnormally!!");
}
+ if (ProcessWriteSlaves() < 0) {
+ jack_error("JackAudioDriver::ProcessGraphSync: ProcessWriteSlaves error,
engine may now behave abnormally!!");
+ }
+
} else { // Graph not finished: do not activate it
jack_error("JackAudioDriver::ProcessGraphSync: Process error");
}
--
2.7.4
Best regards
Adam Miartus
Engineering Software Multimedia (ADITG/ESM)
Tel. +49 5121 49 6973
Show replies by thread