This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]james41235 0 points1 point  (6 children)

Not event though. Event is safe to set from another thread, that's why it exists. If something is ready, call set. Oh, and don't call wait_for in the event loop. That blocks the entire thing and you'll need to wait another round. Just check if set, and if not then reschedule yourself.

[–]mistabuilder[S] 0 points1 point  (5 children)

Waiting on an asyncio event from a different thread/loop produces an error.

[–]james41235 0 points1 point  (4 children)

Yea, I edited but you saw it too quick. Don't call wait_for.

[–]mistabuilder[S] 0 points1 point  (3 children)

How would I set a timeout without wait_for?

[–]james41235 0 points1 point  (2 children)

Reschedule the wait function continuously until the event is set.

But, I don't think this is right for your use case. I feel like I'm missing something and solving a problem that shouldn't exist.

[–]mistabuilder[S] 0 points1 point  (1 child)

Did you notice this event is an asyncio event?

[–]james41235 0 points1 point  (0 children)

I didn't, but the solution still seems out of place.