Unit WThread

******************************************************} {* *} {* Copyright (c) Dan Daley 1996 *} {* Contact: daley@guernsey.com *} {* URL: http://www.guernsey.com *} {* *} {* This code is provided as is for your use. It may *} {* be modified and redistributed. All I ask is that *} {* any modifications be described in this header and *} {* that you provide a means for others to contact you *} {* regarding your modifications. *} {* *} {* This code is not to be sold and must be distributed *} {* for free. *} {* *} {

Classes

TWinThread -

Functions

Register - code that is called when a thread is ends execution

resume the user's thread

Types

TSafeExecCode
TWinThreadEvent
TWinThreadException
TWinThreadInfo
TWinThreadParam

Constants

WM_SafeExec
WM_ThreadException
WM_ThreadTerm

Variables


Functions


procedure Register;

code that is called when a thread is ends execution

resume the user's thread


Types


TSafeExecCode = procedure (Param: LongInt) of object
your thread handle
TWinThreadEvent = function(Sender: TComponent; ThreadInfo: TWinThreadParam): THandle of Object

TWinThreadException = procedure(Sender: TComponent; ThreadInfo: TWinThreadInfo; E:Exception) of Object

TWinThreadInfo = record
ThreadComp : TWinThread;
ThreadProc : TWinThreadEvent;
ThreadParam : pointer;
ThreadHandle : THandle;
SpawnEvent : THandle;
UserThread : Boolean;
end;
TWinThreadInfo is used by start thread to execute your thread code
TWinThreadParam = record
ThreadComp : TWinThread;
ThreadParam : pointer;
ThreadHandle : THandle;
end;
TWinThreadParam is passed as an argument to your thread procedure

Constants

WM_SafeExec = WM_User + 1

WM_ThreadException = WM_User + 3

WM_ThreadTerm = WM_User + 2


Variables