From 96e87ae457516a1787f49861ce2b0c2f933d0c80 Mon Sep 17 00:00:00 2001 From: Adam Waldenberg Date: Wed, 23 May 2012 09:18:50 +0200 Subject: [PATCH] Added a constant to the blame module for the number of threads. --- blame.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/blame.py b/blame.py index 1dd2762..f57a4c7 100644 --- a/blame.py +++ b/blame.py @@ -28,11 +28,13 @@ import sys import terminal import threading +NUM_THREADS = multiprocessing.cpu_count() + class BlameEntry: rows = 0 comments = 0 -__thread_lock__ = threading.BoundedSemaphore(multiprocessing.cpu_count()) +__thread_lock__ = threading.BoundedSemaphore(NUM_THREADS) __blame_lock__ = threading.Lock() class BlameThread(threading.Thread): @@ -90,7 +92,7 @@ class Blame: Blame.output_progress(i, len(lines)) # Make sure all threads have completed. - for i in range(0, multiprocessing.cpu_count()): + for i in range(0, NUM_THREADS): __thread_lock__.acquire() @staticmethod