diff options
Diffstat (limited to 'lib/system/systhread.nim')
-rwxr-xr-x | lib/system/systhread.nim | 70 |
1 files changed, 1 insertions, 69 deletions
diff --git a/lib/system/systhread.nim b/lib/system/systhread.nim index a124fa92f..0ffc9605c 100755 --- a/lib/system/systhread.nim +++ b/lib/system/systhread.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. @@ -44,72 +44,4 @@ proc atomicDec(memLoc: var int, x: int): int = else: dec(memLoc, x) result = memLoc - -when defined(Windows): - type - THandle = int - TSysThread = THandle - TSysLock {.final, pure.} = object # CRITICAL_SECTION in WinApi - DebugInfo: pointer - LockCount: int32 - RecursionCount: int32 - OwningThread: int - LockSemaphore: int - Reserved: int32 - - proc InitLock(L: var TSysLock) {.stdcall, - dynlib: "kernel32", importc: "InitializeCriticalSection".} - proc Aquire(L: var TSysLock) {.stdcall, - dynlib: "kernel32", importc: "EnterCriticalSection".} - proc Release(L: var TSysLock) {.stdcall, - dynlib: "kernel32", importc: "LeaveCriticalSection".} - - proc CreateThread(lpThreadAttributes: Pointer, dwStackSize: int32, - lpStartAddress: pointer, lpParameter: Pointer, - dwCreationFlags: int32, lpThreadId: var int32): THandle {. - stdcall, dynlib: "kernel32", importc: "CreateThread".} - - -else: - type - TSysLock {.importc: "pthread_mutex_t", header: "<sys/types.h>".} = int - TSysThread {.importc: "pthread_t", header: "<sys/types.h>".} = int - - proc InitLock(L: var TSysLock, attr: pointer = nil) {. - importc: "pthread_mutex_init", header: "<pthread.h>".} - proc Aquire(L: var TSysLock) {. - importc: "pthread_mutex_lock", header: "<pthread.h>".} - proc Release(L: var TSysLock) {. - importc: "pthread_mutex_unlock", header: "<pthread.h>".} - - -type - TThread* = TSysThread - TLock* = TSysLock - TThreadFunc* = proc (closure: pointer) {.cdecl.} - -#DWORD WINAPI SuspendThread( -# __in HANDLE hThread -#); -#DWORD WINAPI ResumeThread( -# __in HANDLE hThread -#); -#DWORD WINAPI ThreadProc( -# __in LPVOID lpParameter -#); - -proc createThread*(t: var TThread, fn: TThreadFunc, closure: pointer) = - when defined(windows): - nil - else: - nil - #pthread_create( - -proc joinThread*(t: TThread) = - nil - -#proc pthread_exit(void *value_ptr) - -proc destroyThread*(t: var TThread) = - nil |