Mercurial > vba-clojure
view src/win32/7zip/7z/C/Threads.h @ 1:f9f4f1b99eed
importing src directory
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Sat, 03 Mar 2012 10:31:27 -0600 |
parents | |
children |
line wrap: on
line source
1 /* Threads.h -- multithreading library2 2008-11-22 : Igor Pavlov : Public domain */4 #ifndef __7Z_THRESDS_H5 #define __7Z_THRESDS_H7 #include "Types.h"9 typedef struct _CThread10 {11 HANDLE handle;12 } CThread;14 #define Thread_Construct(thread) (thread)->handle = NULL15 #define Thread_WasCreated(thread) ((thread)->handle != NULL)17 typedef unsigned THREAD_FUNC_RET_TYPE;18 #define THREAD_FUNC_CALL_TYPE MY_STD_CALL19 #define THREAD_FUNC_DECL THREAD_FUNC_RET_TYPE THREAD_FUNC_CALL_TYPE21 WRes Thread_Create(CThread *thread, THREAD_FUNC_RET_TYPE (THREAD_FUNC_CALL_TYPE *startAddress)(void *), LPVOID parameter);22 WRes Thread_Wait(CThread *thread);23 WRes Thread_Close(CThread *thread);25 typedef struct _CEvent26 {27 HANDLE handle;28 } CEvent;30 typedef CEvent CAutoResetEvent;31 typedef CEvent CManualResetEvent;33 #define Event_Construct(event) (event)->handle = NULL34 #define Event_IsCreated(event) ((event)->handle != NULL)36 WRes ManualResetEvent_Create(CManualResetEvent *event, int initialSignaled);37 WRes ManualResetEvent_CreateNotSignaled(CManualResetEvent *event);38 WRes AutoResetEvent_Create(CAutoResetEvent *event, int initialSignaled);39 WRes AutoResetEvent_CreateNotSignaled(CAutoResetEvent *event);40 WRes Event_Set(CEvent *event);41 WRes Event_Reset(CEvent *event);42 WRes Event_Wait(CEvent *event);43 WRes Event_Close(CEvent *event);46 typedef struct _CSemaphore47 {48 HANDLE handle;49 } CSemaphore;51 #define Semaphore_Construct(p) (p)->handle = NULL53 WRes Semaphore_Create(CSemaphore *p, UInt32 initiallyCount, UInt32 maxCount);54 WRes Semaphore_ReleaseN(CSemaphore *p, UInt32 num);55 WRes Semaphore_Release1(CSemaphore *p);56 WRes Semaphore_Wait(CSemaphore *p);57 WRes Semaphore_Close(CSemaphore *p);60 typedef CRITICAL_SECTION CCriticalSection;62 WRes CriticalSection_Init(CCriticalSection *p);63 #define CriticalSection_Delete(p) DeleteCriticalSection(p)64 #define CriticalSection_Enter(p) EnterCriticalSection(p)65 #define CriticalSection_Leave(p) LeaveCriticalSection(p)67 #endif