summaryrefslogtreecommitdiff
path: root/lib/git/async/pool.py
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2010-06-09 16:59:17 +0200
committerSebastian Thiel <byronimo@gmail.com>2010-06-09 16:59:17 +0200
commit365fb14ced88a5571d3287ff1698582ceacd80d6 (patch)
tree49344760ab12a9b031e5dbcde92aa0f7347dd875 /lib/git/async/pool.py
parentea81f14dafbfb24d70373c74b5f8dabf3f2225d9 (diff)
downloadgitpython-365fb14ced88a5571d3287ff1698582ceacd80d6.tar.gz
task: redesigned write channel access to allow the task creator to set own write channels, possibly some with callbacks installed etc.. Pool.add_task will respect the users choice now, but provide defaults which are optimized for performance
Diffstat (limited to 'lib/git/async/pool.py')
-rw-r--r--lib/git/async/pool.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/git/async/pool.py b/lib/git/async/pool.py
index 7d4e96d1..f7c1cfe0 100644
--- a/lib/git/async/pool.py
+++ b/lib/git/async/pool.py
@@ -388,18 +388,21 @@ class Pool(object):
self._taskorder_cache.clear()
self._tasks.add_node(task)
- # fix locks - in serial mode, the task does not need real locks
- # Additionally, use a non-threadsafe queue
+ # Use a non-threadsafe queue
# This brings about 15% more performance, but sacrifices thread-safety
# when reading from multiple threads.
if self.size() == 0:
wctype = SerialWChannel
# END improve locks
- # setup the tasks channel
- wc = wctype()
+ # setup the tasks channel - respect the task creators choice though
+ # if it is set.
+ wc = task.wchannel()
+ if wc is None:
+ wc = wctype()
+ # END create write channel ifunset
rc = RPoolChannel(wc, task, self)
- task.set_wc(wc)
+ task.set_wchannel(wc)
finally:
self._taskgraph_lock.release()
# END sync task addition