added starter/stopper to task_producer arguments, forward to _as_task

This commit is contained in:
2021-10-26 19:42:03 +02:00
parent 808bd4785c
commit adbdfa6ffc
+2 -2
View File
@@ -2,12 +2,12 @@ from functools import wraps
from slic.utils import forwards_to
def task_producer(obj, func):
def task_producer(obj, func, starter=None, stopper=None):
@forwards_to(func, nfilled=1) # nfilled=1 to remove self
@wraps(func)
def wrapper(*args, hold=False, **kwargs):
filled_func = lambda: func(*args, **kwargs)
return obj._as_task(filled_func, hold=hold)
return obj._as_task(filled_func, starter=starter, stopper=stopper, hold=hold)
return wrapper