Author: duncan
Date: Fri Oct 6 20:34:55 2006
New Revision: 8329
Modified:
branches/rel-1-5/freevo/src/tv/channels.py
Log:
Added critical section around calls to getVideoGroup
Modified: branches/rel-1-5/freevo/src/tv/channels.py
==============================================================================
--- branches/rel-1-5/freevo/src/tv/channels.py (original)
+++ branches/rel-1-5/freevo/src/tv/channels.py Fri Oct 6 20:34:55 2006
@@ -43,6 +43,7 @@
import config, plugin
import tv.freq, tv.v4l2
import epg_xmltv
+import threading
import time
DEBUG = config.DEBUG
@@ -72,6 +73,7 @@
def __init__(self):
self.chan_index = 0
+ self.lock = threading.Lock()
if config.plugin_external_tuner:
plugin.init_special_plugin(config.plugin_external_tuner)
@@ -81,16 +83,20 @@
"""
Gets the VideoGroup object used by this Freevo channel.
"""
- group = 0
-
- for i in range(len(config.TV_CHANNELS)):
- chan_info = config.TV_CHANNELS[i]
- if chan_info[2] == chan:
- try:
- group = int(chan_info[4])
- except:
- # XXX: put a better exception here
- group = 0
+ try:
+ self.lock.acquire()
+ group = 0
+
+ for i in range(len(config.TV_CHANNELS)):
+ chan_info = config.TV_CHANNELS[i]
+ if chan_info[2] == chan:
+ try:
+ group = int(chan_info[4])
+ except:
+ # XXX: put a better exception here
+ group = 0
+ finally:
+ self.lock.release()
return config.VIDEO_GROUPS[group]
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog