<div dir="auto"><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Ondrej Pokorny via fpc-devel <<a href="mailto:fpc-devel@lists.freepascal.org">fpc-devel@lists.freepascal.org</a>> schrieb am Mo., 19. Dez. 2022, 08:30:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 19.12.2022 07:42, Sven Barth via fpc-devel wrote:<br>
> The RTL assumes that it does not have to deal with threads during the <br>
> initialization of the System unit. So even if the symptom of the crash <br>
> is fixed in that location it isn't said that something else might <br>
> crash or that in the future code might be added that crashes...<br>
<br>
Is it possible to acknowledge that the current RTLs assumption is wrong <br>
and it has to deal with threads during the System initialization? <br>
(Because obviously the assumption is wrong, otherwise there was no crash.)<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">The RTL needs to make some assumptions, because it is the one that sets up the synchronization primitives and under normal circumstances this assumption *is* true. As you mentioned in the other mail the crash depends upon execution speed and thus it could very well happen during initialization of the heap as well. </div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
That means not to fix the symptom with checking <br>
"Assigned(WideStringManager.GetStandardCodePageProc)" but acknowledge <br>
that the OS can start a thread before System initialization is done and <br>
create a mechanism to postpone thread initialization until System is <br>
fully initialized.<br>
<br>
Something like:<br>
<br>
procedure InitThread(stklen:SizeUInt);<br>
begin<br>
// new code begin<br>
while not SystemInitialized do<br>
Sleep(10);<br>
// new code end<br>
{$ifndef FPUNONE}<br>
SysResetFPU;<br>
{$endif}<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">It will probably come to something like this. </div><div dir="auto"><br></div><div dir="auto">Though we should first check what it means for the user if the debugger thread is hold in place. </div><div dir="auto"><br></div><div dir="auto">Regards, </div><div dir="auto">Sven </div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
</blockquote></div></div></div>