U vi@sPddlmZmZddlmZmZddlmZmZddlm Z Gddde Z dS) )FutureThreadPoolExecutor)AnyOptional)abctyping)NewThreadSchedulercs@eZdZdZGdddejZdeeddfdd Z Z S) ThreadPoolSchedulerz4A scheduler that schedules work via the thread pool.c@s>eZdZdZeejdddZddddZddd d Z dS) z$ThreadPoolScheduler.ThreadPoolThreadz&Wraps a concurrent future as a thread.)executortargetcCs||_||_d|_dSN)r r future)selfr r rX/opt/alt/python38/lib/python3.8/site-packages/reactivex/scheduler/threadpoolscheduler.py__init__sz-ThreadPoolScheduler.ThreadPoolThread.__init__N)returncCs|j|j|_dSr )r submitr rrrrrstartsz*ThreadPoolScheduler.ThreadPoolThread.startcCs|jr|jdSr )rcancelrrrrrsz+ThreadPoolScheduler.ThreadPoolThread.cancel) __name__ __module__ __qualname____doc__rrStartableTargetrrrrrrrThreadPoolThread s  rN) max_workersrcs4t|d_tjtjdfdd }t|dS)N)r)r rcsj|Sr )rr )r rrrthread_factory sz4ThreadPoolScheduler.__init__..thread_factory)rr rrr rsuperr)rrr __class__rrrs  zThreadPoolScheduler.__init__)N) rrrrrZ StartableBaserrintr __classcell__rrr!rr sr N) concurrent.futuresrrrrrZ reactivexrZnewthreadschedulerr r rrrrs