Skip to content
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

Why is this desperation-ware? #3

Open
altendky opened this issue Jul 26, 2019 · 8 comments
Open

Why is this desperation-ware? #3

altendky opened this issue Jul 26, 2019 · 8 comments

Comments

@altendky
Copy link

Do you have an explanation of what makes this only appropriate for use in desperate situations? Does it end up being more or less a full CPU usage busy loop with the while True:?

@henry232323
Copy link
Owner

It's a project I put together in my spare time to learn more about both Trio and the Qt event loop. It's not maintained and I used some slightly dirty tricks. It gets the job done, but it won't eat your CPU I don't think.

@henry232323
Copy link
Owner

Is this something you're interested in using?

@altendky
Copy link
Author

altendky commented Aug 6, 2019

I presently work with Qt and Twisted and have interest in switching to Trio as at some point I've got a major rewrite coming anyways. I read through python-trio/trio#399 once anyways, but should again. I haven't actually decided though if I can fit developing the Trio/Qt integration into my plans. I've got a lot I want to do differently. :[ But sure, there's some chance that one way or another I end up using this and contributing here or otherwise working on a solution.

@henry232323
Copy link
Owner

It's worth giving a try. Trio is a great library. What I've whipped up here is likely the simplest solution, but I cannot say whether it is the best solution.

@goodboy
Copy link

goodboy commented Apr 16, 2020

@henry232323 fwiw this definitely eats my CPU lol 😸

@henry232323
Copy link
Owner

henry232323 commented Apr 16, 2020

@goodboy Does it now? Whats your use case?

@henry232323 henry232323 reopened this Apr 16, 2020
@goodboy
Copy link

goodboy commented Apr 16, 2020

@henry232323 yessir. Have you tested for this before?

It makes sense too, a trio.sleep(0) merely triggers a breakpoint in the trio scheduler which in the idle case is essentially a noop. The only way I can see it not doing this is if the poll loop had blocking code or lots QT events to process that would mask the while loop spinning.

@henry232323
Copy link
Owner

Perhaps its worth inserting a brief normal sleep? Generally I would expect the trio event loop to handle a little downtime to avoid spinning the wheels, but its probably worth doing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants