Make sure that pthread_create is checked.
From: Erik Hovland <erik@hovland.org>
---
libs/libmythtv/RingBuffer.cpp | 7 ++++++-
libs/libmythtv/dvbstreamhandler.cpp | 10 ++++++++--
libs/libmythtv/signalmonitor.cpp | 9 ++++++++-
3 files changed, 22 insertions(+), 4 deletions(-)
diff --git a/libs/libmythtv/RingBuffer.cpp b/libs/libmythtv/RingBuffer.cpp
index 47baee0..ed8cd2c 100644
a
|
b
|
void RingBuffer::StartupReadAheadThread(void) |
631 | 631 | readaheadrunning = false; |
632 | 632 | |
633 | 633 | readAheadRunningCondLock.lock(); |
634 | | pthread_create(&reader, NULL, StartReader, this); |
| 634 | int rval = pthread_create(&reader, NULL, StartReader, this); |
| 635 | if (rval != 0) { |
| 636 | VERBOSE(VB_IMPORTANT, QString("RingBuffer::StartupReadAheadThread: " |
| 637 | "pthread_create failed with %1").arg(strerror(rval))); |
| 638 | return; |
| 639 | } |
635 | 640 | readAheadRunningCond.wait(&readAheadRunningCondLock); |
636 | 641 | readAheadRunningCondLock.unlock(); |
637 | 642 | } |
diff --git a/libs/libmythtv/dvbstreamhandler.cpp b/libs/libmythtv/dvbstreamhandler.cpp
index 30b911e..18f6d11 100644
a
|
b
|
void DVBStreamHandler::Start(void) |
189 | 189 | if (!IsRunning()) |
190 | 190 | { |
191 | 191 | QMutex is_running_lock; |
192 | | pthread_create(&_reader_thread, NULL, |
193 | | run_dvb_stream_handler_thunk, this); |
| 192 | int rval = pthread_create(&_reader_thread, NULL, |
| 193 | run_dvb_stream_handler_thunk, this); |
| 194 | if (rval < 0) |
| 195 | { |
| 196 | VERBOSE(VB_IMPORTANT, LOC_ERR + QString("DVBStreamHandler::Start - " |
| 197 | "failed creating thread. Error %1").arg(strerror(errno))); |
| 198 | return; |
| 199 | } |
194 | 200 | |
195 | 201 | while (!IsRunning()) |
196 | 202 | { |
diff --git a/libs/libmythtv/signalmonitor.cpp b/libs/libmythtv/signalmonitor.cpp
index c376cec..f18e99b 100644
a
|
b
|
void SignalMonitor::Start() |
205 | 205 | { |
206 | 206 | QMutexLocker locker(&startStopLock); |
207 | 207 | if (!running) |
208 | | pthread_create(&monitor_thread, NULL, SpawnMonitorLoop, this); |
| 208 | { |
| 209 | if (pthread_create(&monitor_thread, NULL, SpawnMonitorLoop, this) == -1) |
| 210 | { |
| 211 | VERBOSE(VB_IMPORTANT, "Failed to create signal monitor thread"); |
| 212 | return; |
| 213 | } |
| 214 | } |
| 215 | |
209 | 216 | while (!running) |
210 | 217 | usleep(50); |
211 | 218 | } |