summaryrefslogtreecommitdiffstats
path: root/module/ThreadManager.py
diff options
context:
space:
mode:
authorGravatar mkaay <mkaay@mkaay.de> 2010-11-05 16:45:06 +0100
committerGravatar mkaay <mkaay@mkaay.de> 2010-11-05 16:45:06 +0100
commit1d74a9dcb91d16929a65a24d81ec441874ce4976 (patch)
treedba60b1a47ec4bf3a61e863f9102ec5b57296568 /module/ThreadManager.py
parentsmall fixes: progess view in gui,xdcc,shareonline (diff)
downloadpyload-1d74a9dcb91d16929a65a24d81ec441874ce4976.tar.xz
sj fix
Diffstat (limited to 'module/ThreadManager.py')
-rw-r--r--module/ThreadManager.py27
1 files changed, 25 insertions, 2 deletions
diff --git a/module/ThreadManager.py b/module/ThreadManager.py
index eba23f28c..d17281e9d 100644
--- a/module/ThreadManager.py
+++ b/module/ThreadManager.py
@@ -25,6 +25,7 @@ from threading import Event
from time import sleep
from traceback import print_exc
from random import choice
+from threading import Lock
import pycurl
import PluginThread
@@ -56,8 +57,30 @@ class ThreadManager:
for i in range(0, self.core.config.get("general", "max_downloads")):
self.createThread()
-
-
+ self.occupiedCrypter = []
+ self.occupiedCrypterLock = Lock()
+
+ #----------------------------------------------------------------------
+ def addOccupiedCrypter(self, name):
+ self.occupiedCrypterLock.acquire()
+ if not name in self.occupiedCrypter:
+ self.occupiedCrypter.append(name)
+ print True
+ self.occupiedCrypterLock.release()
+
+ def removeOccupiedCrypter(self, name):
+ self.occupiedCrypterLock.acquire()
+ if name in self.occupiedCrypter:
+ print True
+ self.occupiedCrypter.remove(name)
+ self.occupiedCrypterLock.release()
+
+ def isOccupiedCrypter(self, name):
+ self.occupiedCrypterLock.acquire()
+ ret = name in self.occupiedCrypter
+ self.occupiedCrypterLock.release()
+ return ret
+
#----------------------------------------------------------------------
def createThread(self):
"""create a download thread"""