From c929c936dcfec395c57b0a1836708caa961092f9 Mon Sep 17 00:00:00 2001 From: "Tim E. Real" Date: Sun, 13 Feb 2011 22:55:46 +0000 Subject: Correction: Check pthread_create return value, not handle. Test OK. --- muse2/muse/driver/dummyaudio.cpp | 5 +++-- muse2/muse/thread.cpp | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/muse2/muse/driver/dummyaudio.cpp b/muse2/muse/driver/dummyaudio.cpp index d251c79f..0d495ea9 100644 --- a/muse2/muse/driver/dummyaudio.cpp +++ b/muse2/muse/driver/dummyaudio.cpp @@ -185,6 +185,7 @@ DummyAudioDevice::DummyAudioDevice() //posix_memalign((void**)&buffer, 16, sizeof(float) * dummyFrames); posix_memalign((void**)&buffer, 16, sizeof(float) * config.dummyAudioBufSize); + dummyThread = 0; realtimeFlag = false; state = Audio::STOP; _framePos = 0; @@ -440,7 +441,7 @@ void DummyAudioDevice::start(int priority) } int rv = pthread_create(&dummyThread, attributes, ::dummyLoop, this); - if(!dummyThread) + if(rv) { // p4.0.16: realTimeScheduling is unreliable. It is true even in some clearly non-RT cases. // I cannot seem to find a reliable answer to the question of "are we RT or not". @@ -450,7 +451,7 @@ void DummyAudioDevice::start(int priority) rv = pthread_create(&dummyThread, NULL, ::dummyLoop, this); } - if(rv || !dummyThread) + if(rv) fprintf(stderr, "creating dummy audio thread failed: %s\n", strerror(rv)); if (attributes) // p4.0.16 diff --git a/muse2/muse/thread.cpp b/muse2/muse/thread.cpp index 8e89a862..67daf07b 100644 --- a/muse2/muse/thread.cpp +++ b/muse2/muse/thread.cpp @@ -100,7 +100,7 @@ void Thread::start(int prio, void* ptr) int rv = pthread_create(&thread, attributes, ::loop, this); - if(!thread) + if(rv) { // p4.0.16: realTimeScheduling is unreliable. It is true even in some clearly non-RT cases. // I cannot seem to find a reliable answer to the question of "are we RT or not". @@ -110,7 +110,7 @@ void Thread::start(int prio, void* ptr) rv = pthread_create(&thread, NULL, ::loop, this); } - if(rv || !thread) + if(rv) fprintf(stderr, "creating thread <%s> failed: %s\n", _name, strerror(rv)); if (attributes) // p4.0.16 -- cgit v1.2.3