Hacker News new | past | comments | ask | show | jobs | submit login

I'm wondering what happens before all this -- how is the OS loader even notified about the new thread? Is it the thread entrypoint itself that tells the OS loader about the new thread's creation (and destruction)?



Both the loader and thread management are part of the OS. It's an implementation detail, but I'd expect CreateThread to do it - perhaps by delegating to the loader, perhaps by navigating the loader's list of loaded modules, whatever.

See these pages:

https://docs.microsoft.com/en-us/windows/win32/api/processth...

https://docs.microsoft.com/en-us/windows/win32/dlls/dllmain


The thing about CreateThread doing it is that then a thread created in a different matter (CreateRemoteThread from another process, RtlCreateUserThread, etc.) would cause a missed notification. I feel like it has to be the entrypoint, but not sure...


Sure, but when I say CreateThread I mean the implementation of CreateThread, not the function CreateThread.

(This feels like a weird autistic conversation, I'm going to step out now.)




Consider applying for YC's Summer 2025 batch! Applications are open till May 13

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: