Skip to content

Commit

Permalink
Comment on why set_thread_private_dcontext(NULL) is needed
Browse files Browse the repository at this point in the history
  • Loading branch information
mariospaok4 committed Feb 11, 2025
1 parent 1bbb955 commit f51dae3
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions core/unix/os.c
Original file line number Diff line number Diff line change
Expand Up @@ -2379,6 +2379,12 @@ os_tls_init(void)
if (last_thread_tls_exited) /* re-attach */
last_thread_tls_exited = false;
}

/* We need to make sure that get_thread_private_dcontext() returns NULL until
* set it to something else. If CONTEXT_REBASE_OFFT is non-zero we have to
* call set_thread_private_dcontext(NULL) expilcitely, or otherwise
* get_thread_private_dcontext() will return NULL - CONTEXT_REBASE_OFFT.
*/
#if (CONTEXT_REBASE_OFFT != 0)
set_thread_private_dcontext(NULL);
#endif
Expand Down

0 comments on commit f51dae3

Please sign in to comment.