diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2006-01-01 14:46:24 +0100 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2006-01-01 14:46:24 +0100 |
commit | 7d84ddefb3fc3c1dab66864b114fdd85af18cd4e (patch) | |
tree | 8ab1f255354e0b484181fe7ffd69775346bf4fb2 | |
parent | fef0b70bb11e85bc5ef7a0c8c5dbc42e5f9f1faa (diff) | |
download | vdr-7d84ddefb3fc3c1dab66864b114fdd85af18cd4e.tar.gz vdr-7d84ddefb3fc3c1dab66864b114fdd85af18cd4e.tar.bz2 |
Made the static cControl functions thread safe
-rw-r--r-- | CONTRIBUTORS | 1 | ||||
-rw-r--r-- | HISTORY | 1 | ||||
-rw-r--r-- | player.c | 7 | ||||
-rw-r--r-- | player.h | 3 |
4 files changed, 10 insertions, 2 deletions
diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 48c95d8b..c1977138 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -1554,6 +1554,7 @@ Nicolas Huillard <nhuillard@e-dition.fr> Patrick Fischer <patrick_fischer@gmx.de> for reporting an error in the cFilter example in PLUGINS.html + for making the static cControl functions thread safe Ralf Müller <ralf@bj-ig.de> for a patch that was used to implement cUnbufferedFile @@ -4057,3 +4057,4 @@ Video Disk Recorder Revision History Jürgen Schneider). - Removed unused variables in skinclassic.c and skinsttng.c (thanks to Marco Schlüßler). +- Made the static cControl functions thread safe (thanks to Patrick Fischer). @@ -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; @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: player.h 1.17 2005/05/22 11:07:42 kls Exp $ + * $Id: player.h 1.18 2006/01/01 14:43:10 kls Exp $ */ #ifndef __PLAYER_H @@ -62,6 +62,7 @@ public: class cControl : public cOsdObject { private: static cControl *control; + static cMutex mutex; bool attached; bool hidden; protected: |