RFR: 8304939: os::win32::exit_process_or_thread should be marked noreturn [v5]
David Holmes
dholmes at openjdk.org
Mon Oct 30 08:28:32 UTC 2023
On Mon, 30 Oct 2023 07:36:43 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:
>> Julian Waters has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Revert to exit_code in os_windows.cpp
>
> src/hotspot/os/windows/os_windows.cpp line 571:
>
>> 569: // let it proceed to exit normally
>> 570: exit_process_or_thread(EPT_THREAD, res);
>> 571: return res;
>
> exit_process_or_thread is now marked noreturn. So it looks like thread_native_entry never returns either
> now, making the return of res (and res itself) effectively unused, and the comment obsolete.
>
> I don't know what the implications of marking thread_native_entry noreturn might be. Passing it as a
> parameter to _beginthreadex might be a problem. But it kind of seems like thread_native_entry shouldn't
> be calling exit_process_or_thread? The semantics of the "start_address" function for _beginthreadex
> are rather lightly documented so far as I could find.
It has to call `exit_process_or_thread` because of the exit bug. That means we will directly call `_endthreadex` instead of implicitly doing that by having the entry function return. The `return res` is redundant but keeps the compiler happy given the required declaration of the entry method.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/16303#discussion_r1375837737
More information about the hotspot-dev
mailing list