summaryrefslogtreecommitdiffstats
path: root/pyload/threads/ThreadManager.py
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2013-12-30 19:52:29 +0100
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2013-12-30 19:52:29 +0100
commit1e338a279aba747534fd1e7aedc8d7aec319f5f2 (patch)
tree87f809fabd8c11f45d193475937223bfd097e33c /pyload/threads/ThreadManager.py
parentadded progress type enum, new DebugCrypter + Hoster, little improvements for ... (diff)
downloadpyload-1e338a279aba747534fd1e7aedc8d7aec319f5f2.tar.xz
show progress of decrypting and link checking, added indicator in link grabber
Diffstat (limited to 'pyload/threads/ThreadManager.py')
-rw-r--r--pyload/threads/ThreadManager.py16
1 files changed, 13 insertions, 3 deletions
diff --git a/pyload/threads/ThreadManager.py b/pyload/threads/ThreadManager.py
index 3132e98e2..0e0b6320d 100644
--- a/pyload/threads/ThreadManager.py
+++ b/pyload/threads/ThreadManager.py
@@ -19,7 +19,7 @@
from os.path import exists, join
import re
from subprocess import Popen
-from threading import Event, Lock
+from threading import Event, RLock
from time import sleep, time
from traceback import print_exc
from random import choice
@@ -53,7 +53,7 @@ class ThreadManager:
self.reconnecting.clear()
self.downloaded = 0 #number of files downloaded since last cleanup
- self.lock = Lock()
+ self.lock = RLock()
# some operations require to fetch url info from hoster, so we caching them so it wont be done twice
# contains a timestamp and will be purged after timeout
@@ -71,13 +71,23 @@ class ThreadManager:
for i in range(self.core.config.get("download", "max_downloads")):
self.createThread()
-
def createThread(self):
"""create a download thread"""
thread = DownloadThread(self)
self.threads.append(thread)
+ @lock
+ def addThread(self, thread):
+ self.localThreads.append(thread)
+
+ @lock
+ def removeThread(self, thread):
+ """ Remove a thread from the local list """
+ if thread in self.localThreads:
+ self.localThreads.remove(thread)
+
+ @lock
def createInfoThread(self, data, pid):
""" start a thread which fetches online status and other info's """
self.timestamp = time() + 5 * 60