CancellationToken parameter in Main method #81415
Replies: 1 comment
-
|
Looks like .NET Team is against this: dotnet/runtime#28510 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Proposal
Would it be possible to add a
CancellationTokenparameter to program'sMainmethod that will be triggered when either of these POSIX signals are received?SIGHUPCTRL_CLOSE_EVENTSIGINTCTRL_C_EVENTSIGQUITCTRL_BREAK_EVENTSIGTERMCTRL_SHUTDOWN_EVENTNew
Mainmethod signatures:C# compiler probably can generate the supporting code for this parameter by using the PosixSignalRegistration class.
Motivation
This is just a convenience. I'm aware that this can be achieved by using
PosixSignalRegistrationclass directly: Example.But, again, the
string[] argsparameter is a convenience too: it can easily be replaced by a call to Environment.GetCommandLineArgs method.Beta Was this translation helpful? Give feedback.
All reactions