Sujet : Re: [Tutor] How to stop a specific thread in Python 2.7?
De : cs (at) *nospam* cskk.id.au (Cameron Simpson)
Groupes : comp.lang.pythonDate : 04. Oct 2024, 01:17:19
Autres entêtes
Message-ID : <mailman.35.1727997930.3018.python-list@python.org>
References : 1 2
User-Agent : Mutt/2.2.13 (2024-03-09)
On 03Oct2024 22:12, Dan Ciprus (dciprus) <
dciprus@cisco.com> wrote:
I'd be interested too :-).
Untested sketch:
def make_thread(target, *a, E=None, **kw):
'''
Make a new Event E and Thread T, pass `[E,*a]` as the target positional arguments.
A shared preexisting Event may be supplied.
Return a 2-tuple of `(T,E)`.
'''
if E is None:
E = Event()
T = Thread(target=target, args=[E, *a], kwargs=kw)
return T, E
Something along those lines.
Cheers,
Cameron Simpson <
cs@cskk.id.au>