mirror of
https://github.com/VDR4Arch/vdr.git
synced 2023-10-10 13:36:52 +02:00
Fixed handling childTid in cThread to avoid possible race conditions
This commit is contained in:
parent
ba85b34c62
commit
c33dccf9ba
@ -188,6 +188,7 @@ Stefan Huelswitt <huels@iname.com>
|
|||||||
for reporting a bug in setting the title in the replay display of the "Classic VDR"
|
for reporting a bug in setting the title in the replay display of the "Classic VDR"
|
||||||
skin in case a shorter title is set after a longer one
|
skin in case a shorter title is set after a longer one
|
||||||
for fixing handling of pmAudioOnlyBlack
|
for fixing handling of pmAudioOnlyBlack
|
||||||
|
for pointing out possible race conditions in handling childTid in cThread
|
||||||
|
|
||||||
Ulrich Röder <roeder@efr-net.de>
|
Ulrich Röder <roeder@efr-net.de>
|
||||||
for pointing out that there are channels that have a symbol rate higher than
|
for pointing out that there are channels that have a symbol rate higher than
|
||||||
|
2
HISTORY
2
HISTORY
@ -3159,3 +3159,5 @@ Video Disk Recorder Revision History
|
|||||||
overhead in the firmware (thanks to Werner Fink).
|
overhead in the firmware (thanks to Werner Fink).
|
||||||
- Now checking available OSD memory at runtime (thanks to Oliver Endriss).
|
- Now checking available OSD memory at runtime (thanks to Oliver Endriss).
|
||||||
- Fixed some typos in the Makefile's 'font' target (thanks to Olaf Titz).
|
- Fixed some typos in the Makefile's 'font' target (thanks to Olaf Titz).
|
||||||
|
- Fixed handling childTid in cThread to avoid possible race conditions (thanks
|
||||||
|
to Stefan Huelswitt for pointing this out).
|
||||||
|
13
thread.c
13
thread.c
@ -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.c 1.36 2004/10/31 09:54:02 kls Exp $
|
* $Id: thread.c 1.37 2004/11/20 16:21:14 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "thread.h"
|
#include "thread.h"
|
||||||
@ -233,12 +233,15 @@ void *cThread::StartThread(cThread *Thread)
|
|||||||
|
|
||||||
bool cThread::Start(void)
|
bool cThread::Start(void)
|
||||||
{
|
{
|
||||||
|
Lock();
|
||||||
if (!childTid) {
|
if (!childTid) {
|
||||||
parentTid = pthread_self();
|
parentTid = pthread_self();
|
||||||
pthread_create(&childTid, NULL, (void *(*) (void *))&StartThread, (void *)this);
|
pthread_t Tid;
|
||||||
pthread_detach(childTid); // auto-reap
|
pthread_create(&Tid, NULL, (void *(*) (void *))&StartThread, (void *)this);
|
||||||
pthread_setschedparam(childTid, SCHED_RR, 0);
|
pthread_detach(Tid); // auto-reap
|
||||||
|
pthread_setschedparam(Tid, SCHED_RR, 0);
|
||||||
}
|
}
|
||||||
|
Unlock();
|
||||||
return true; //XXX return value of pthread_create()???
|
return true; //XXX return value of pthread_create()???
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -277,10 +280,12 @@ void cThread::Cancel(int WaitSeconds)
|
|||||||
}
|
}
|
||||||
esyslog("ERROR: thread %ld won't end (waited %d seconds) - cancelling it...", childTid, WaitSeconds);
|
esyslog("ERROR: thread %ld won't end (waited %d seconds) - cancelling it...", childTid, WaitSeconds);
|
||||||
}
|
}
|
||||||
|
Lock();
|
||||||
if (childTid) {
|
if (childTid) {
|
||||||
pthread_cancel(childTid);
|
pthread_cancel(childTid);
|
||||||
childTid = 0;
|
childTid = 0;
|
||||||
}
|
}
|
||||||
|
Unlock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user