summaryrefslogtreecommitdiff
path: root/player.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2006-01-01 14:46:24 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2006-01-01 14:46:24 +0100
commit7d84ddefb3fc3c1dab66864b114fdd85af18cd4e (patch)
tree8ab1f255354e0b484181fe7ffd69775346bf4fb2 /player.c
parentfef0b70bb11e85bc5ef7a0c8c5dbc42e5f9f1faa (diff)
downloadvdr-7d84ddefb3fc3c1dab66864b114fdd85af18cd4e.tar.gz
vdr-7d84ddefb3fc3c1dab66864b114fdd85af18cd4e.tar.bz2
Made the static cControl functions thread safe
Diffstat (limited to 'player.c')
-rw-r--r--player.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/player.c b/player.c
index 80e384fa..74b19362 100644
--- a/player.c
+++ b/player.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: player.c 1.9 2004/12/12 11:21:07 kls Exp $
+ * $Id: player.c 1.10 2006/01/01 14:45:36 kls Exp $
*/
#include "player.h"
@@ -40,6 +40,7 @@ void cPlayer::Detach(void)
// --- cControl --------------------------------------------------------------
cControl *cControl::control = NULL;
+cMutex cControl::mutex;
cControl::cControl(cPlayer *Player, bool Hidden)
{
@@ -56,17 +57,20 @@ cControl::~cControl()
cControl *cControl::Control(void)
{
+ cMutexLock MutexLock(&mutex);
return (control && !control->hidden) ? control : NULL;
}
void cControl::Launch(cControl *Control)
{
+ cMutexLock MutexLock(&mutex);
delete control;
control = Control;
}
void cControl::Attach(void)
{
+ cMutexLock MutexLock(&mutex);
if (control && !control->attached && control->player && !control->player->IsAttached()) {
if (cDevice::PrimaryDevice()->AttachPlayer(control->player))
control->attached = true;
@@ -79,6 +83,7 @@ void cControl::Attach(void)
void cControl::Shutdown(void)
{
+ cMutexLock MutexLock(&mutex);
cControl *c = control; // avoids recursions
control = NULL;
delete c;