Rare case of not properly rounding up thread stack size on Windows · Issue #9445...
source link: https://github.com/rust-lang/rust/issues/94454
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
The following code states that stack_size
rounds up to the next 64 kB:
// Round up to the next 64 kB because that's what the NT kernel does,
// might as well make it explicit.
let stack_size = (stack + 0xfffe) & (!0xfffe);
However, if stack
is any of 0xffff * x + 1
(where x is a non-negative number) it will not properly round up. Additionally, the least significant byte is retained, I doubt that is intended either. Am I missing something? Otherwise I believe it's meant to be 0xffff
instead of 0xfffe
to properly round up.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK