https://bugs.winehq.org/show_bug.cgi?id=43966
--- Comment #16 from Ken Thomases ken@codeweavers.com --- (In reply to VitorMM from comment #15)
(In reply to Ken Thomases from comment #9)
Yes, basically. I wouldn't bother changing LDT_SIZE. If Wine tries values past what the OS supports, it will just fail in a slightly different way than if it knows it has exhausted the limit. Either way, that would only affect processes with many threads.
But isn't it going to give a faster answer if it exhausts the limit instead of waiting until it receives a system error/warning/exception?
"Faster answer"? In either case, the failure would only happen at the time of the attempt to create the 125th thread or whatever. If the call to i386_set_ldt() fails because you let Wine try a too-high index, then you get the "i386_set_ldt: Invalid argument" message and probably an access violation immediately afterward.
If you change LDT_SIZE so that Wine doesn't even try the too-high index, then CreateThread()/CreateRemoteThread()/RtlCreateUserThread() returns an error status code. The caller may or may not actually check the return value. If it doesn't, then it just goes on assuming the thread was created when it wasn't. There may or may not be immediately obvious consequences, including log messages.
In any case, this should just be a temporary hack for a beta version of the OS. It's not terribly important exactly how it fails, is it?