NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Is NetBSD _lwp_self equivalent to SYS_gettid on Linux? [Was: SYS_gettid alternative on NetBSD]



On Fri, Jul 22, 2022 at 12:07:36PM +0530, Mayuresh wrote:
>     /usr/pkgsrc/work/wip/py-torch/work/pytorch/third_party/kineto/libkineto/src/ThreadUtil.cpp:52:32: error: 'SYS_gettid' was not declared in this scope
>          _sysTid = (int32_t)syscall(SYS_gettid);
> 
> The concerned function is:
> 
>     int32_t systemThreadId() {
>       if (!_sysTid) {
>     #ifdef __APPLE__
>         _sysTid = (int32_t)syscall(SYS_thread_selfid);
>     #elif defined _MSC_VER
>         _sysTid = (int32_t)GetCurrentThreadId();
>     #else
>         _sysTid = (int32_t)syscall(SYS_gettid);
>     #endif
>       }
>       return _sysTid;
>     }

The following thread seems to suggest _lwp_self could be used on NetBSD in
above code. Can someone comment?

https://stackoverflow.com/questions/4004155/how-to-get-thread-id-as-integer-on-bsd-in-c-c

-- 
Mayuresh


Home | Main Index | Thread Index | Old Index