-
Notifications
You must be signed in to change notification settings - Fork 575
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
Fiber.sleep Caused the loss of "tasks" #311
Comments
I don't know the reason, but the problem has been solved by changing the codding.
|
|
|
If the above problem is solved, think about the following code:
|
I know.
|
I haven't run the code, so take this with a grain of salt (i.e, it may be totally wrong). But I think the reason the first example exits is very simple. You reach the end of the main thread, and your application exits. The fiber isn't its own thread. If you created a new thread, then joined the fiber inside of it, and didn't join the new thread in your You can see a similar issue here: https://stackoverflow.com/questions/52196187/what-happen-with-coroutines-when-main-thread-exits |
please run it "gradle -q run",observe what the console prints
Why only output 2?
3 was eaten?
The text was updated successfully, but these errors were encountered: