From f46870fe1ce3a28ab44417effd1c684522568a8d Mon Sep 17 00:00:00 2001 From: Araq Date: Sat, 29 Jan 2011 01:47:58 +0100 Subject: changes to threads; --recursivePath support --- lib/system/cgprocs.nim | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'lib/system') diff --git a/lib/system/cgprocs.nim b/lib/system/cgprocs.nim index cabdcafc4..945ce4692 100755 --- a/lib/system/cgprocs.nim +++ b/lib/system/cgprocs.nim @@ -1,7 +1,7 @@ # # # Nimrod's Runtime Library -# (c) Copyright 2010 Andreas Rumpf +# (c) Copyright 2011 Andreas Rumpf # # See the file "copying.txt", included in this # distribution, for details about the copyright. @@ -24,3 +24,27 @@ proc nimLoadLibraryError(path: string) {.compilerproc, noinline.} proc setStackBottom(theStackBottom: pointer) {.compilerRtl, noinline.} +# Support for thread local storage: +when false: + when defined(windows): + proc TlsAlloc(): int32 {.importc: "TlsAlloc", stdcall, dynlib: "kernel32".} + proc TlsSetValue(dwTlsIndex: int32, lpTlsValue: pointer) {. + importc: "TlsSetValue", stdcall, dynlib: "kernel32".} + proc TlsGetValue(dwTlsIndex: int32): pointer {. + importc: "TlsGetValue", stdcall, dynlib: "kernel32".} + + else: + type + Tpthread_key {.importc: "pthread_key_t", header: "".} = int + + proc pthread_getspecific(a1: Tpthread_key): pointer {. + importc: "pthread_getspecific", header: "".} + proc pthread_key_create(a1: ptr Tpthread_key, + a2: proc (x: pointer) {.noconv.}): int32 {. + importc: "pthread_key_create", header: "".} + proc pthread_key_delete(a1: Tpthread_key): int32 {. + importc: "pthread_key_delete", header: "".} + + proc pthread_setspecific(a1: Tpthread_key, a2: pointer): int32 {. + importc: "pthread_setspecific", header: "".} + -- cgit 1.4.1-2-gfad0