Optimized streamer thread termination.

This commit is contained in:
Rolf Ahrenberg 2008-09-10 17:22:36 +03:00
parent 4e8e26a4b3
commit c5a7598544
3 changed files with 5 additions and 2 deletions

View File

@ -70,3 +70,4 @@ VDR Plugin 'iptv' Revision History
- Tweaked pid scanner parameters for HD broadcasts.
- Fixed opening of fifo tap.
- Updated iptvstream.sh script to support optional video resolution settings.
- Optimized streamer thread termination.

View File

@ -45,11 +45,11 @@ void cIptvStreamer::Action(void)
}
else {
mutex->Unlock();
cCondWait::SleepMs(100); // to reduce cpu load
sleep.Wait(100); // to reduce cpu load
}
}
else
cCondWait::SleepMs(100); // and avoid busy loop
sleep.Wait(100); // and avoid busy loop
}
debug("cIptvStreamer::Action(): Exiting\n");
}
@ -69,6 +69,7 @@ bool cIptvStreamer::Close(void)
{
debug("cIptvStreamer::Close()\n");
// Stop thread
sleep.Signal();
if (Running())
Cancel(3);
// Close the protocol. A mutex should be taken here to avoid a race condition

View File

@ -20,6 +20,7 @@ class cIptvStreamer : public cThread, public cIptvStreamerStatistics {
private:
cRingBufferLinear* ringBuffer;
cMutex* mutex;
cCondWait sleep;
unsigned char* readBuffer;
unsigned int readBufferLen;
cIptvProtocolIf* protocol;