diff options
Diffstat (limited to 'lib/system/threads.nim')
-rw-r--r-- | lib/system/threads.nim | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/system/threads.nim b/lib/system/threads.nim index 003969a79..86af95a85 100644 --- a/lib/system/threads.nim +++ b/lib/system/threads.nim @@ -204,7 +204,12 @@ else: proc getThreadId*(): int = ## get the ID of the currently running thread. result = int(syscall(NR_gettid)) - elif defined(macosx) or defined(bsd): + elif defined(dragonfly): + proc lwp_gettid(): int32 {.importc, header: "unistd.h".} + + proc getThreadId*(): int = + result = int(lwp_gettid()) + elif defined(macosx) or defined(freebsd) or defined(openbsd) or defined(netbsd): proc pthread_threadid_np(y: pointer; x: var uint64): cint {.importc, header: "pthread.h".} proc getThreadId*(): int = @@ -221,7 +226,6 @@ else: ## get the ID of the currently running thread. result = int(thr_self()) - const emulatedThreadVars = compileOption("tlsEmulation") |