Overview
Comment: | Subversion to Fossil Copy Commit. Please Ignore. Recording copying build/cackey_win32_build/include/pthread.h to build/cackey_win64_build/include/pthread.h. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
5bd5ef312f186366951091595ee5b597 |
User & Date: | rkeene on 2012-07-19 05:39:05 |
Other Links: | manifest | tags |
Context
2012-07-19
| ||
05:39 | Updated to build using mingw32-w64 built-in winscard check-in: a2b7df3c9a user: rkeene tags: trunk | |
05:39 | Subversion to Fossil Copy Commit. Please Ignore. Recording copying build/cackey_win32_build/include/pthread.h to build/cackey_win64_build/include/pthread.h. check-in: 5bd5ef312f user: rkeene tags: trunk | |
05:29 | Corrected PC/SC test check-in: b0c5c2ea32 user: rkeene tags: trunk | |
Changes
Added build/cackey_win64_build/include/pthread.h version [bedfe2684e].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | /* Thread_emulation.h */ /* Author: Johnson M. Hart */ /* Emulate the Pthreads model for the Win32 platform */ /* The emulation is not complete, but it does provide a subset */ /* required for a first project */ /* Source: http://world.std.com/~jmhart/opensource.htm */ /* The emulation is not complete, but it does provide a subset */ /* that will work with many well-behaved programs */ /* IF YOU ARE REALLY SERIOUS ABOUT THIS, USE THE OPEN SOURCE */ /* PTHREAD LIBRARY. YOU'LL FIND IT ON THE RED HAT SITE */ #ifndef _THREAD_EMULATION # define _THREAD_EMULATION /* Thread management macros */ # ifdef _WIN32 # define _WIN32_WINNT 0x500 /* WINBASE.H - Enable SignalObjectAndWait */ # include <process.h> # include <windows.h> # define THREAD_FUNCTION_PROTO THREAD_FUNCTION_RETURN (__stdcall *) (void *) # define THREAD_FUNCTION_RETURN unsigned int # define THREAD_SPECIFIC_INDEX DWORD # define pthread_t HANDLE # define pthread_attr_t DWORD # define pthread_create(thhandle, attr, thfunc, tharg) ((int) ((*thhandle = (HANDLE) _beginthreadex(NULL, 0, (THREAD_FUNCTION_PROTO) thfunc, tharg, 0, NULL)) == NULL)) # define pthread_join(thread, result) ((WaitForSingleObject((thread), INFINITE) != WAIT_OBJECT_0) || !CloseHandle(thread)) # define pthread_detach(thread) { if (((void *) thread) != NULL) { CloseHandle((void *) thread); }} # define thread_sleep(nms) Sleep(nms) # define pthread_cancel(thread) TerminateThread(thread, 0) # define ts_key_create(ts_key, destructor) {ts_key = TlsAlloc();} # define pthread_getspecific(ts_key) TlsGetValue(ts_key) # define pthread_setspecific(ts_key, value) TlsSetValue(ts_key, (void *)value) # define pthread_self() GetCurrentThreadId() # else # include <pthread.h> # define THREAD_FUNCTION_RETURN void * # endif /* Syncrhronization macros: Win32->pthread */ # ifdef _WIN32 # define pthread_mutex_t HANDLE # define pthread_cond_t HANDLE # define pthread_mutex_lock(pobject) WaitForSingleObject(*pobject, INFINITE) # define pthread_mutex_unlock(pobject) (!ReleaseMutex(*pobject)) # define pthread_mutex_init(pobject,pattr) ((*pobject=CreateMutex(NULL, FALSE, NULL)) == NULL) # define pthread_cond_init(pobject,pattr) (*pobject=CreateEvent(NULL, FALSE, FALSE, NULL)) # define pthread_mutex_destroy(pobject) CloseHandle(*pobject) # define pthread_cond_destroy(pobject) CloseHandle(*pobject) # define pthread_cond_wait(pcv,pmutex) { SignalObjectAndWait(*pmutex, *pcv, INFINITE, FALSE); WaitForSingleObject(*pmutex, INFINITE); } # define pthread_cond_signal(pcv) SetEvent(*pcv) # endif #endif |