-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Only single instance of Tnz
feasible
#71
Comments
You're expectations of Threading was mentioned. Tnz uses the asyncio event loop to manage I/O. To use different Tnz instances in different threads means you would need a different asyncio event loop for each. I do not plan on forcing Tnz instances to have different asyncio event loops. That could change another potential expectation from the scenario in the description - that while waiting for one session, I/O is proceeding for other sessions. However, you can control the loop because
|
Hey, speaking of event loop... would you consider adding support for uvloop? |
I wouldn't except there would be any advantage to using uvloop when running zti. I've never used uvloop personally. But it is described as being a drop-in replacement for asyncio and it has instructions on how to enable it by setting it as the default event loop policy. So, your program should be able to do that and then tnz should use it. If there is some issue with using uvloop and tnz together, I would welcome an Issue for it. But I would not expect tnz to depend on uvloop. |
I decided that requiring a |
Description
We keep exploring the lib which really look promising. Thanks for doing it.
But the critical limitation we ran into is that it's not possible to get multiple fully functional instances of the
Tnz
class.As far as I can see, the code uses global objects like
_wait_event
which breaks any possibility of that.Generally, it'd be very nice for
Tnz
to be fully thread-safe.Simple demo of the issue
The code below causes a deadlock:
The text was updated successfully, but these errors were encountered: