Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix windows binaries exiting with code 24 #449

Open
wants to merge 1 commit into
base: per-thread-state
Choose a base branch
from

Conversation

isanych
Copy link

@isanych isanych commented Jul 5, 2023

Unfortunately I cannot provide reasonable reproducible example - but we had regular cases when binary sporadically exit with code 24 on big multithreaded projects on windows only, when linux binary working fine on the same project on similar hardware.
Looks like windows code intended to be initialized differently vs posix, but as posix code is working and compatible with windows we have not looked into details too much. With this change our windows binaries are working as expected, without issues seen before.

@markpmitchell
Copy link
Contributor

Is yices_init being called in multiple threads? If so, how many? Is yices_exit being called before yices_init is being called again? The Windows code would seem to exit with code 24 if there are no more TLS indices -- and there should be plenty.

@wojbas
Copy link

wojbas commented Oct 18, 2023

The Win32 code is wrong in that the TLS should be initialized once (in yices_init), not per thread (as is the case now in yices_per_thread_init), so consumes a slot with every call to yices_per_thread_init, which we call a lot.

* usage of the API.
*/
if (!yices_tls_initialized) {
yices_tls_error_index = TlsAlloc();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

despite the comment above this is called via yices_per_thread_init and not yices_init

@markpmitchell
Copy link
Contributor

markpmitchell commented Oct 18, 2023 via email

@isanych
Copy link
Author

isanych commented Oct 18, 2023

yep, it is PR for per-thread-state branch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants