Skip to content

Commit d0f7c87

Browse files
committed
dummy.Pool: Add maxtasksperchild parameter
1 parent 17758b2 commit d0f7c87

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

Lib/multiprocessing/dummy/__init__.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,11 @@
1717
# Imports
1818
#
1919

20-
import threading
20+
import array
2121
import sys
22+
import threading
2223
import weakref
23-
import array
24+
import warnings
2425

2526
from .connection import Pipe
2627
from threading import Lock, RLock, Semaphore, BoundedSemaphore
@@ -119,7 +120,10 @@ def Manager():
119120
def shutdown():
120121
pass
121122

122-
def Pool(processes=None, initializer=None, initargs=()):
123+
def Pool(processes=None, initializer=None, initargs=(), maxtasksperchild=None):
124+
if maxtasksperchild is not None:
125+
warnings.warn("maxtasksperchild makes no sense for a ThreadPool and is ignored")
126+
123127
from ..pool import ThreadPool
124128
return ThreadPool(processes, initializer, initargs)
125129

0 commit comments

Comments
 (0)