Workaround lack of multiprocessing on Jython

This commit is contained in:
William Turner 2019-03-17 16:21:59 -04:00 committed by Casper da Costa-Luis
parent d6c7b955e8
commit d1187ac546
No known key found for this signature in database
GPG Key ID: 986B408043AE090D
1 changed files with 2 additions and 2 deletions

View File

@ -21,7 +21,6 @@ from numbers import Number
from time import time
from contextlib import contextmanager
# For parallelism safety
import multiprocessing as mp
import threading as th
from warnings import warn
@ -104,7 +103,8 @@ class TqdmDefaultWriteLock(object):
def create_mp_lock(cls):
if not hasattr(cls, 'mp_lock'):
try:
cls.mp_lock = mp.RLock() # multiprocessing lock
from multiprocessing import RLock
cls.mp_lock = RLock() # multiprocessing lock
except ImportError: # pragma: no cover
cls.mp_lock = None
except OSError: # pragma: no cover