diff options
author | George Hazan <george.hazan@gmail.com> | 2015-11-11 15:06:35 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2015-11-11 15:06:35 +0000 |
commit | 9dbda7a1ea9d0ac91e02bf4e605618203faf83bc (patch) | |
tree | a9bd5e9b1d65664ac00635d8fd2ecd1217df5c85 /include | |
parent | d6990ccddb9d6f432fd0392e241d48f95102cf13 (diff) |
thread library:
- _beginthread replaced with CreateThread();
- functions forkthread & forkthreadex removed;
- macroses mir_forkthread, mir_forkthreadex & mir_forkthreadowner became real functions;
git-svn-id: http://svn.miranda-ng.org/main/trunk@15710 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'include')
-rw-r--r-- | include/delphi/m_core.inc | 10 | ||||
-rw-r--r-- | include/delphi/m_helpers.inc | 22 | ||||
-rw-r--r-- | include/m_core.h | 31 |
3 files changed, 20 insertions, 43 deletions
diff --git a/include/delphi/m_core.inc b/include/delphi/m_core.inc index 624d5cd317..acc558ece9 100644 --- a/include/delphi/m_core.inc +++ b/include/delphi/m_core.inc @@ -553,9 +553,13 @@ function Thread_Pop():int_ptr; stdcall; procedure Thread_Wait(); stdcall;
external CoreDLL name 'Thread_Wait';
-function forkthread(func:pThreadFunc; stacksize:uint; arg:pointer):uint_ptr; stdcall;
- external CoreDLL name 'forkthread';
-function forkthreadex(sec:pointer; stacksize:uint; func:pThreadFuncEx; owner:pointer; arg:pointer; thraddr:puint_ptr):uint_ptr; stdcall;
+function mir_forkthread(aFunc:pThreadFunc; arg:pointer):THANDLE; stdcall;
+ external CoreDLL name 'forkthreadex';
+
+function mir_forkthreadex(aFunc:pThreadFuncEx; arg:pointer; pThreadID:puint_ptr):THANDLE; stdcall;
+ external CoreDLL name 'forkthreadex';
+
+function mir_forkthreadowner(aFunc:pThreadFuncOwner; owner:pointer; arg:pointer; pThreadID:puint_ptr):THANDLE; stdcall;
external CoreDLL name 'forkthreadex';
procedure Thread_SetName(const szThreadName:PAnsiChar); stdcall;
diff --git a/include/delphi/m_helpers.inc b/include/delphi/m_helpers.inc index 3bad7b4ed7..21d5570f0a 100644 --- a/include/delphi/m_helpers.inc +++ b/include/delphi/m_helpers.inc @@ -16,10 +16,6 @@ function CreateVersionStringPlugin(pluginInfo:PPluginInfoEx;buf:PAnsiChar):PAnsi function PLUGIN_MAKE_VERSION(a,b,c,d: Cardinal): int;
function PLUGIN_CMP_VERSION(verA: LongInt; verB: LongInt): int;
-function mir_forkthread(aFunc:pThreadFunc; arg:pointer):THANDLE; {inline}
-function mir_forkthreadex(aFunc:pThreadFuncEx; arg:pointer; pThreadID:puint_ptr):THANDLE; {inline}
-function mir_forkthreadowner(aFunc:pThreadFuncOwner; owner:pointer; arg:pointer; pThreadID:puint_ptr):THANDLE; {inline}
-
function Netlib_CloseHandle(Handle: THANDLE): int;
function Netlib_GetBase64DecodedBufferSize(const cchEncoded: int): int;
function Netlib_GetBase64EncodedBufferSize(const cbDecoded: int): int;
@@ -188,24 +184,6 @@ begin Inc(Result, (verA and $FF000000) - (verB and $FF000000));
end;
-
-function mir_forkthread(aFunc:pThreadFunc; arg:pointer):THANDLE;
- {$IFDEF AllowInline}inline;{$ENDIF}
-begin
- result:=forkthread(aFunc, 0, arg);
-end;
-function mir_forkthreadex(aFunc:pThreadFuncEx; arg:pointer; pThreadID:puint_ptr):THANDLE;
- {$IFDEF AllowInline}inline;{$ENDIF}
-begin
- result:=forkthreadex(nil, 0, aFunc, nil, arg, pThreadID);
-end;
-function mir_forkthreadowner(aFunc:pThreadFuncOwner; owner:pointer; arg:pointer; pThreadID:puint_ptr):THANDLE;
- {$IFDEF AllowInline}inline;{$ENDIF}
-begin
- result:=forkthreadex(nil, 0, pThreadFuncEx(aFunc), owner, arg, pThreadID);
-end;
-
-
function Netlib_CloseHandle(Handle: THANDLE): int;
{$IFDEF AllowInline}inline;{$ENDIF}
begin
diff --git a/include/m_core.h b/include/m_core.h index 0634c63d7a..a9a900f03c 100644 --- a/include/m_core.h +++ b/include/m_core.h @@ -554,32 +554,27 @@ public: ///////////////////////////////////////////////////////////////////////////////
// threads
-typedef void (__cdecl *pThreadFunc)(void*);
-typedef unsigned (__stdcall *pThreadFuncEx)(void*);
-typedef unsigned (__cdecl *pThreadFuncOwner)(void *owner, void* param);
+typedef void (__cdecl *pThreadFunc)(void *param);
+typedef unsigned (__stdcall *pThreadFuncEx)(void *param);
+typedef unsigned (__cdecl *pThreadFuncOwner)(void *owner, void *param);
#if defined( __cplusplus )
- MIR_CORE_DLL(INT_PTR) Thread_Push(HINSTANCE hInst, void* pOwner=NULL);
+ MIR_CORE_DLL(INT_PTR) Thread_Push(HINSTANCE hInst, void* pOwner = NULL);
#else
MIR_CORE_DLL(INT_PTR) Thread_Push(HINSTANCE hInst, void* pOwner);
#endif
MIR_CORE_DLL(INT_PTR) Thread_Pop(void);
MIR_CORE_DLL(void) Thread_Wait(void);
-MIR_CORE_DLL(UINT_PTR) forkthread(pThreadFunc, unsigned long stacksize, void *arg);
-MIR_CORE_DLL(UINT_PTR) forkthreadex(void *sec, unsigned stacksize, pThreadFuncEx, void* owner, void *arg, unsigned *thraddr);
-
-__forceinline HANDLE mir_forkthread(pThreadFunc aFunc, void* arg)
-{ return (HANDLE)forkthread(aFunc, 0, arg);
-}
-
-__forceinline HANDLE mir_forkthreadex(pThreadFuncEx aFunc, void* arg, unsigned* pThreadID)
-{ return (HANDLE)forkthreadex(NULL, 0, aFunc, NULL, arg, pThreadID);
-}
-
-__forceinline HANDLE mir_forkthreadowner(pThreadFuncOwner aFunc, void* owner, void* arg, unsigned* pThreadID)
-{ return (HANDLE)forkthreadex(NULL, 0, (pThreadFuncEx)aFunc, owner, arg, pThreadID);
-}
+#if defined( __cplusplus )
+MIR_CORE_DLL(HANDLE) mir_forkthread(pThreadFunc aFunc, void *arg = NULL);
+MIR_CORE_DLL(HANDLE) mir_forkthreadex(pThreadFuncEx aFunc, void *arg = NULL, unsigned *pThreadID = NULL);
+MIR_CORE_DLL(HANDLE) mir_forkthreadowner(pThreadFuncOwner aFunc, void *owner, void *arg = NULL, unsigned *pThreadID = NULL);
+#else
+MIR_CORE_DLL(HANDLE) mir_forkthread(pThreadFunc aFunc, void *arg);
+MIR_CORE_DLL(HANDLE) mir_forkthreadex(pThreadFuncEx aFunc, void *arg, unsigned *pThreadID);
+MIR_CORE_DLL(HANDLE) mir_forkthreadowner(pThreadFuncOwner aFunc, void *owner, void *arg, unsigned *pThreadID);
+#endif
MIR_CORE_DLL(void) Thread_SetName(const char *szThreadName);
|