-
Notifications
You must be signed in to change notification settings - Fork 680
allow completely single-threaded NIO programs #1499
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally seems good, one question and one piece of feedback.
89b5271
to
bca1a32
Compare
@glbrntt / @Lukasa I agree that it's weird to call this on I felt it's not really worth adding a new top-level namespace for a function that'll be as rarely used as this one so I put it into MTELG and thought we can always (deprecate) move it elsewhere in the future. But 100% open to moving it. |
@swift-server-bot test this please |
this is great @weissi, can be very useful in one of our projects. thanks! |
481d919
to
19ed719
Compare
Motivation: Usually, you spawn a new MultiThreadedEventLoopGroup to run NIO programs. But if you're a very simple command line utility, that may not be necessary, so why not just re-use the main thread? Modifications: Allow taking over threads and making them EventLoops. Result: Fewer threads if you want.
19ed719
to
a3b0d29
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok great, let's ship this.
Motivation: Usually, you spawn a new MultiThreadedEventLoopGroup to run NIO programs. But if you're a very simple command line utility, that may not be necessary, so why not just re-use the main thread? Modifications: Allow taking over threads and making them EventLoops. Result: Fewer threads if you want. Co-authored-by: Cory Benfield <lukasa@apple.com>
Motivation:
Usually, you spawn a new MultiThreadedEventLoopGroup to run NIO
programs. But if you're a very simple command line utility, that may not
be necessary, so why not just re-use the main thread?
Modifications:
Allow taking over threads and making them EventLoops.
Result:
Fewer threads if you want.