mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-16 10:19:30 +02:00
* closethread thread manager field/function. Mantis 13160
git-svn-id: trunk@15072 -
This commit is contained in:
parent
d8a902b4c4
commit
8cce3d3f91
@ -143,6 +143,12 @@ begin
|
||||
Result:=CurrentTM.ResumeThread(ThreadHandle);
|
||||
end;
|
||||
|
||||
function CloseThread (threadHandle : TThreadID):dword;
|
||||
|
||||
begin
|
||||
result:=CurrentTM.CloseThread(ThreadHandle);
|
||||
end;
|
||||
|
||||
procedure ThreadSwitch;
|
||||
|
||||
begin
|
||||
@ -359,6 +365,13 @@ begin
|
||||
NoThreadError;
|
||||
end;
|
||||
|
||||
function NoCloseThread (threadHandle : TThreadID):dword;
|
||||
|
||||
begin
|
||||
Result:=0; // avoid warnings.
|
||||
NoThreadError;
|
||||
end;
|
||||
|
||||
function NoWaitForThreadTerminate (threadHandle : TThreadID; TimeoutMs : longint) : dword; {0=no timeout}
|
||||
begin
|
||||
NoThreadError;
|
||||
@ -585,6 +598,7 @@ begin
|
||||
SuspendThread :=@NoThreadHandler;
|
||||
ResumeThread :=@NoThreadHandler;
|
||||
KillThread :=@NoThreadHandler;
|
||||
CloseThread :=@NoCloseThread;
|
||||
ThreadSwitch :=@NoThreadSwitch;
|
||||
WaitForThreadTerminate :=@NoWaitForThreadTerminate;
|
||||
ThreadSetPriority :=@NoThreadSetPriority;
|
||||
|
@ -62,6 +62,7 @@ type
|
||||
SuspendThread : TThreadHandler;
|
||||
ResumeThread : TThreadHandler;
|
||||
KillThread : TThreadHandler;
|
||||
CloseThread : TThreadHandler;
|
||||
ThreadSwitch : TThreadSwitchHandler;
|
||||
WaitForThreadTerminate : TWaitForThreadTerminateHandler;
|
||||
ThreadSetPriority : TThreadSetPriorityHandler;
|
||||
@ -133,6 +134,7 @@ procedure EndThread;
|
||||
procedure FlushThread;
|
||||
function SuspendThread (threadHandle : TThreadID) : dword;
|
||||
function ResumeThread (threadHandle : TThreadID) : dword;
|
||||
function CloseThread (threadHandle : TThreadID) : dword;
|
||||
procedure ThreadSwitch; {give time to other threads}
|
||||
function KillThread (threadHandle : TThreadID) : dword;
|
||||
function WaitForThreadTerminate (threadHandle : TThreadID; TimeoutMs : longint) : dword; {0=no timeout}
|
||||
|
@ -253,6 +253,11 @@ end;
|
||||
}
|
||||
end;
|
||||
|
||||
function SysCloseThread (threadHandle : TThreadID) : dword;
|
||||
begin
|
||||
// SysCloseThread:=CloseHandle(threadHandle);
|
||||
end;
|
||||
|
||||
function SysWaitForThreadTerminate (ThreadHandle: dword;
|
||||
TimeoutMs: longint): dword;
|
||||
begin
|
||||
@ -450,6 +455,7 @@ begin
|
||||
WaitForThreadTerminate :=@SysWaitForThreadTerminate;
|
||||
ThreadSetPriority :=@SysThreadSetPriority;
|
||||
ThreadGetPriority :=@SysThreadGetPriority;
|
||||
CloseThrad :=@SysCloseThread;
|
||||
GetCurrentThreadId :=@SysGetCurrentThreadId;
|
||||
InitCriticalSection :=@SysInitCriticalSection;
|
||||
DoneCriticalSection :=@SysDoneCriticalSection;
|
||||
|
@ -369,6 +369,10 @@ Type PINTRTLEvent = ^TINTRTLEvent;
|
||||
CKillThread := pthread_cancel(pthread_t(threadHandle));
|
||||
end;
|
||||
|
||||
function CCloseThread (threadHandle : TThreadID) : dword;
|
||||
begin
|
||||
result:=0;
|
||||
end;
|
||||
|
||||
function CWaitForThreadTerminate (threadHandle : TThreadID; TimeoutMs : longint) : dword; {0=no timeout}
|
||||
var
|
||||
@ -944,6 +948,7 @@ begin
|
||||
ResumeThread :=@CResumeThread;
|
||||
KillThread :=@CKillThread;
|
||||
ThreadSwitch :=@CThreadSwitch;
|
||||
CloseThread :=@CCloseThread;
|
||||
WaitForThreadTerminate :=@CWaitForThreadTerminate;
|
||||
ThreadSetPriority :=@CThreadSetPriority;
|
||||
ThreadGetPriority :=@CThreadGetPriority;
|
||||
|
@ -46,6 +46,7 @@ function LocalFree(hMem : Pointer):Pointer; {$ifdef wince}cdecl{$else}stdcall{$e
|
||||
procedure Sleep(dwMilliseconds: DWord); {$ifdef wince}cdecl{$else}stdcall{$endif};external KernelDLL name 'Sleep';
|
||||
function WinSuspendThread (threadHandle : THandle) : dword; {$ifdef wince}cdecl{$else}stdcall{$endif};external KernelDLL name 'SuspendThread';
|
||||
function WinResumeThread (threadHandle : THandle) : dword; {$ifdef wince}cdecl{$else}stdcall{$endif};external KernelDLL name 'ResumeThread';
|
||||
function WinCloseHandle (threadHandle : THandle) : dword; {$ifdef wince}cdecl{$else}stdcall{$endif};external KernelDLL name 'CloseHandle';
|
||||
function TerminateThread (threadHandle : THandle; var exitCode : dword) : boolean; {$ifdef wince}cdecl{$else}stdcall{$endif};external KernelDLL name 'TerminateThread';
|
||||
function WaitForSingleObject (hHandle : THandle;Milliseconds: dword): dword; {$ifdef wince}cdecl{$else}stdcall{$endif};external KernelDLL name 'WaitForSingleObject';
|
||||
function WinThreadSetPriority (threadHandle : THandle; Prio: longint): boolean; {$ifdef wince}cdecl{$else}stdcall{$endif};external KernelDLL name 'SetThreadPriority';
|
||||
@ -302,6 +303,11 @@ CONST
|
||||
SysKillThread := 0;
|
||||
end;
|
||||
|
||||
function SysCloseThread (threadHandle : TThreadID) : dword;
|
||||
begin
|
||||
SysCloseThread:=winCloseHandle(threadHandle);
|
||||
end;
|
||||
|
||||
function SysWaitForThreadTerminate (threadHandle : TThreadID; TimeoutMs : longint) : dword;
|
||||
begin
|
||||
if timeoutMs = 0 then dec (timeoutMs); // $ffffffff is INFINITE
|
||||
@ -461,6 +467,7 @@ begin
|
||||
ResumeThread :=@SysResumeThread;
|
||||
KillThread :=@SysKillThread;
|
||||
ThreadSwitch :=@SysThreadSwitch;
|
||||
CloseThread :=@SysCloseThread;
|
||||
WaitForThreadTerminate :=@SysWaitForThreadTerminate;
|
||||
ThreadSetPriority :=@SysThreadSetPriority;
|
||||
ThreadGetPriority :=@SysThreadGetPriority;
|
||||
|
Loading…
Reference in New Issue
Block a user