mirror of
https://github.com/VDR4Arch/vdr.git
synced 2023-10-10 13:36:52 +02:00
Removed the signal handler and WakeUp() call from cThread
This commit is contained in:
parent
343df6266e
commit
73fde7480a
2
HISTORY
2
HISTORY
@ -3063,3 +3063,5 @@ Video Disk Recorder Revision History
|
|||||||
2 * IPACKS to avoid a buffer overflow in case a cTS2PES writes one complete
|
2 * IPACKS to avoid a buffer overflow in case a cTS2PES writes one complete
|
||||||
packet and then (within processing the same TS packet) wants to write another
|
packet and then (within processing the same TS packet) wants to write another
|
||||||
small packet.
|
small packet.
|
||||||
|
- Removed the signal handler and WakeUp() call from cThread (it is no longer
|
||||||
|
needed).
|
||||||
|
21
thread.c
21
thread.c
@ -4,13 +4,12 @@
|
|||||||
* See the main source file 'vdr.c' for copyright information and
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* how to reach the author.
|
||||||
*
|
*
|
||||||
* $Id: thread.c 1.32 2004/10/15 13:15:02 kls Exp $
|
* $Id: thread.c 1.33 2004/10/24 09:47:57 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "thread.h"
|
#include "thread.h"
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
#include <signal.h>
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
@ -186,18 +185,10 @@ void cMutex::Unlock(void)
|
|||||||
|
|
||||||
// --- cThread ---------------------------------------------------------------
|
// --- cThread ---------------------------------------------------------------
|
||||||
|
|
||||||
// The signal handler is necessary to be able to use SIGIO to wake up any
|
|
||||||
// pending 'select()' call.
|
|
||||||
|
|
||||||
bool cThread::signalHandlerInstalled = false;
|
|
||||||
bool cThread::emergencyExitRequested = false;
|
bool cThread::emergencyExitRequested = false;
|
||||||
|
|
||||||
cThread::cThread(const char *Description)
|
cThread::cThread(const char *Description)
|
||||||
{
|
{
|
||||||
if (!signalHandlerInstalled) {
|
|
||||||
signal(SIGIO, SignalHandler);
|
|
||||||
signalHandlerInstalled = true;
|
|
||||||
}
|
|
||||||
running = false;
|
running = false;
|
||||||
parentTid = childTid = 0;
|
parentTid = childTid = 0;
|
||||||
description = NULL;
|
description = NULL;
|
||||||
@ -221,11 +212,6 @@ void cThread::SetDescription(const char *Description, ...)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void cThread::SignalHandler(int signum)
|
|
||||||
{
|
|
||||||
signal(signum, SignalHandler);
|
|
||||||
}
|
|
||||||
|
|
||||||
void *cThread::StartThread(cThread *Thread)
|
void *cThread::StartThread(cThread *Thread)
|
||||||
{
|
{
|
||||||
Thread->childTid = pthread_self();
|
Thread->childTid = pthread_self();
|
||||||
@ -289,11 +275,6 @@ void cThread::Cancel(int WaitSeconds)
|
|||||||
pthread_cancel(childTid);
|
pthread_cancel(childTid);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cThread::WakeUp(void)
|
|
||||||
{
|
|
||||||
pthread_kill(parentTid, SIGIO); // makes any waiting 'select()' call return immediately
|
|
||||||
}
|
|
||||||
|
|
||||||
bool cThread::EmergencyExit(bool Request)
|
bool cThread::EmergencyExit(bool Request)
|
||||||
{
|
{
|
||||||
if (!Request)
|
if (!Request)
|
||||||
|
5
thread.h
5
thread.h
@ -4,7 +4,7 @@
|
|||||||
* See the main source file 'vdr.c' for copyright information and
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* how to reach the author.
|
||||||
*
|
*
|
||||||
* $Id: thread.h 1.21 2004/10/15 13:16:39 kls Exp $
|
* $Id: thread.h 1.22 2004/10/24 09:46:36 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __THREAD_H
|
#ifndef __THREAD_H
|
||||||
@ -74,13 +74,10 @@ private:
|
|||||||
bool running;
|
bool running;
|
||||||
char *description;
|
char *description;
|
||||||
static bool emergencyExitRequested;
|
static bool emergencyExitRequested;
|
||||||
static bool signalHandlerInstalled;
|
|
||||||
static void SignalHandler(int signum);
|
|
||||||
static void *StartThread(cThread *Thread);
|
static void *StartThread(cThread *Thread);
|
||||||
protected:
|
protected:
|
||||||
void Lock(void) { mutex.Lock(); }
|
void Lock(void) { mutex.Lock(); }
|
||||||
void Unlock(void) { mutex.Unlock(); }
|
void Unlock(void) { mutex.Unlock(); }
|
||||||
void WakeUp(void);
|
|
||||||
virtual void Action(void) = 0;
|
virtual void Action(void) = 0;
|
||||||
void Cancel(int WaitSeconds = 0);
|
void Cancel(int WaitSeconds = 0);
|
||||||
public:
|
public:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user