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

MacOS build libks error #204

Open
suzp1984 opened this issue Mar 17, 2024 · 1 comment · May be fixed by #205
Open

MacOS build libks error #204

suzp1984 opened this issue Mar 17, 2024 · 1 comment · May be fixed by #205

Comments

@suzp1984
Copy link

suzp1984 commented Mar 17, 2024

This is another duplicated issue of signalwire/homebrew-signalwire#21

Root Cause
The POSIX pthread_self returns the pthread_t, which is a struct, not a unsigned long int alias. And gettid(), which return the current thread id, is not available in mac os.

Solution
https://elliotth.blogspot.com/2012/04/gettid-on-mac-os.html

uint64_t tid;
pthread_threadid_np(NULL, &tid);

or

syscall(SYS_thread_selfid)

But syscall is deprecated in macOS 10.12, there will be a warning. I suggest use pthread_threadid_np.

'syscall' is deprecated: first deprecated in macOS 10.12 - syscall(2) is unsupported;

suzp1984 added a commit to suzp1984/libks that referenced this issue Mar 17, 2024
@suzp1984 suzp1984 linked a pull request Mar 17, 2024 that will close this issue
@suzp1984
Copy link
Author

Both the v1 & v2 release has same problem in mac os.
So I guess this PR need to merge to both v1 and v2 release 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 a pull request may close this issue.

1 participant