On 25Sep2024 22:56, marc nicole <mk1853387@gmail.com> wrote:
How to create a per-thread event in Python 2.7?
Every time you make a Thread, make an Event. Pass it to the thread
worker function and keep it to hand for your use outside the thread. _______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
On Thu, 26 Sept 2024, 03:08 Cameron Simpson, <cs@cskk.id.au> wrote:
On 25Sep2024 22:56, marc nicole <mk1853387@gmail.com> wrote:--=20
How to create a per-thread event in Python 2.7?
Every time you make a Thread, make an Event. Pass it to the thread
worker function and keep it to hand for your use outside the thread.
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
https://mail.python.org/mailman/listinfo/python-list
I'd be interested too :-).
On 03Oct2024 22:12, Dan Ciprus (dciprus) <dciprus@cisco.com> wrote:=20
I'd be interested too :-).
Untested sketch:
def make_thread(target, *a, E=3DNone, **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 =3D Event()
T =3D Thread(target=3Dtarget, args=3D[E, *a], kwargs=3Dkw)
return T, E
Something along those lines.
Cheers,
Cameron Simpson <cs@cskk.id.au>
Sysop: | Tetrazocine |
---|---|
Location: | Melbourne, VIC, Australia |
Users: | 4 |
Nodes: | 8 (0 / 8) |
Uptime: | 215:16:53 |
Calls: | 73 |
Calls today: | 1 |
Files: | 21,500 |
Messages: | 73,913 |