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

issue #204: fix get pthread id problem. #205

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

suzp1984
Copy link

fix #204

@suzp1984
Copy link
Author

This PR also can fix after merged to release branches.
signalwire/homebrew-signalwire#21

src/ks_thread.c Outdated Show resolved Hide resolved
@andywolk andywolk force-pushed the issue/204-fix-pthread-id branch from fdb10b4 to e4a7d8b Compare February 3, 2025 22:07
@andywolk andywolk requested a review from mjerris February 3, 2025 22:13
uint64_t tid;
int r = pthread_threadid_np(NULL, &tid);
if (!r) {
return tid;
Copy link
Contributor

Choose a reason for hiding this comment

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

This will overflow as returning uint64_t while function returns ks_pid_t that is pid_t aka int.

Copy link
Author

Choose a reason for hiding this comment

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

try fix it on commit : d2cae9c

Copy link
Contributor

Choose a reason for hiding this comment

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

Please note there are places in the code under questions now:

uint32_t id = (uint32_t)ks_thread_self_id();

used += snprintf(buf + used - 1, bufSize - used, "#%8.8X ", id);

uint32_t id = (uint32_t)ks_thread_self_id();

or

static inline unsigned long ks_ssl_thread_id(void)
{
	return ks_thread_self_id();
}
CRYPTO_set_id_callback(ks_ssl_thread_id);

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.

MacOS build libks error
3 participants