On DragonFly BSD lwp_gettid() is only unique within a process (the main
thread is always LWP 1), so combine it with the process id, like Solaris.
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
--- /dev/null
+On DragonFly BSD, :func:`threading.get_native_id` now returns a value that is
+unique across processes, matching the other platforms.
lwpid_t native_id;
native_id = _lwp_self();
#elif defined(__DragonFly__)
- lwpid_t native_id;
- native_id = lwp_gettid();
+ // lwp_gettid() is only unique within a process, so combine it with the pid.
+ unsigned long native_id = (unsigned long)getpid() << 32 | lwp_gettid();
#elif defined(__sun__) && SIZEOF_LONG >= 8
unsigned long native_id = (unsigned long)getpid() << 32 | thr_self();
#endif