-
-
Notifications
You must be signed in to change notification settings - Fork 127
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
[RFC] Global Loop (simplified) #82
Conversation
I'm in favour of this, I think it's a great step in the right direction 👍 |
Would the plan be to have the react libraries to start using |
@mbonneau i'm not sure i'd like an optional loop parameter. I'd prefer simple facade api's on top of the current api's, eg. something i proposed in #77 or @clue in reactphp-legacy/socket-client#38 and reactphp/reactphp#330 which then use the global loop. |
It's been 2 years since this PR was created and it seems to be approved. Are there still plans to adopt this? |
Closing this as it has been resolved through #226 and follow up PR's |
This is a simplified alternative to #77 introducing a global loop on top of the current API and being backward compatible.
To use the global loop,
Factory::create()
can be simply replaced byGlobalLoop::get()
.The global loop is run automatically in a shutdown function, so no need to call
run()
manually. This behaviour can be disabled by callingGlobalLoop::disableRunOnShutdown()
or by simply callingGlobalLoop::get()->run()
.This incorporates the suggestion from @mbonneau (#77 (comment)) and also addresses #77 (comment).