libks icon indicating copy to clipboard operation
libks copied to clipboard

MacOS build libks error

Open suzp1984 opened this issue 2 years ago • 1 comments

This is another duplicated issue of https://github.com/signalwire/homebrew-signalwire/issues/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 avatar Mar 17 '24 02:03 suzp1984

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.

suzp1984 avatar Mar 17 '24 03:03 suzp1984