Commit 9c42af45 authored by Jérome Perrin's avatar Jérome Perrin

raise an error when 'Too many threads'

also use the lock when accessing the active thread count variable


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@3901 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 73b46def
......@@ -277,8 +277,12 @@ class ActivityTool (Folder, UniqueObject):
global active_threads, is_initialized
# return if the number of threads is too high
if active_threads >= max_active_threads:
if not force: return 'Too many threads'
tic_lock.acquire()
too_many_threads = (active_threads >= max_active_threads)
tic_lock.release()
if too_many_threads :
if not force:
raise RuntimeError, 'Too many threads'
if tic_lock is None:
return
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment