Skip to content

Conversation

@tuxxi
Copy link

@tuxxi tuxxi commented Apr 3, 2025

C.f. #12

https://www.gnu.org/software/libc/manual/html_node/Single_002dThreaded.html

Variable: char __libc_single_threaded
This variable is non-zero if the current process is definitely single-threaded. If it is zero, the process may be multi-threaded, or the GNU C Library cannot determine at this point of the program execution whether the process is single-threaded or not.

For now this is a constant zero.

A future enhancement to do this better, would be to detect if any functions from pthread are called, or if libpthread itself is linked dynamically to the binary -- then set this value to nonzero if so.

@IoIxD
Copy link

IoIxD commented Jul 17, 2025

Tested this with my own program, can confirm it works (given the program isn't multi threaded lol).

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.

2 participants