-
Notifications
You must be signed in to change notification settings - Fork 8.4k
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
Disallow a window waiting on system() to block DefTerm startup #14195
Conversation
I don't know if this is correct. It is at best |
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.
Pro tip: hide whitespace changes
@msftbot make sure @lhecker signs off on this |
Hello @carlos-zamora! Because you've given me some instructions on how to help merge this pull request, I'll be modifying my merge approach. Here's how I understand your requirements for merging this pull request:
If this doesn't seem right to you, you can tell me to cancel these instructions and use the auto-merge policy that has been configured for this repository. Try telling me "forget everything I just told you". |
// Try first to send a message to the current foreground window. If it's not responding, it may | ||
// be waiting on us to finsh launching. Give it only 50ms--a tiny time slice--so as to not wait | ||
// too long before failing out. SendMessageTimeoutW returns nonzero if it succeeds. | ||
if (0 != SendMessageTimeoutW(oldForegroundWindow, WM_NULL, 0, 0, SMTO_BLOCK | SMTO_ABORTIFHUNG, 50, nullptr)) |
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.
Is there any specific reason you chose 50? What if the system is currently under heavy load at 100% CPU usage and it takes longer than that to activate the other thread?
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.
I admit that this is a very small timeout. I didn't want to block Terminal's startup for a very long time. I don't know what the right choice is.
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.
Honestly because of ABORTIFHUNG
, we could up it a little bit. We could consider using SMTO_NOTIMEOUTIFNOTHUNG
, which indicates that IF THE THREAD CAN RECEIVE MESSAGES, we will wait possibly-forever for it.
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.
I've changed it to 1000 now after all. I've used SendMessageTimeoutToTopLevelWindowClasses
as a reference which uses 5000 despite using the same 3 flags.
Hello @lhecker! Because this pull request has the p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (
|
@msftgot forget everything I told you |
@msftbot forget everything I told you |
Hello @DHowett! Because you've told me to reset the custom auto-merge settings, I'll use the configured settings for this repository when I'm merging this pull request. |
🎉 Handy links: |
🎉 Handy links: |
We'll just ping the window and give it a chance to respond before we
bunk with it.
Fixes #14131