100
function ThreadProc(ThreadObjPtr: Pointer): Integer;
103
Thread: TThread absolute ThreadObjPtr;
108
Thread.FFatalException := TObject(AcquireExceptionObject);
110
FreeThread := Thread.FFreeOnTerminate;
111
Result := Thread.FReturnValue;
112
Thread.FFinished := True;
114
if FreeThread then Thread.Free;
117
constructor TThread.Create(CreateSuspended: Boolean);
100
constructor TThread.Create(CreateSuspended: Boolean;
101
const StackSize: SizeUInt = DefaultStackSize);
123
107
FSuspended := CreateSuspended;
125
109
if CreateSuspended then Flags := CREATE_SUSPENDED;
126
FHandle := BeginThread(nil, 0, @ThreadProc, pointer(self), Flags, FThreadID);
110
FHandle := BeginThread(nil, StackSize, @ThreadProc, pointer(self), Flags,
127
112
FFatalException := nil;
203
188
function TThread.WaitFor: Integer;
191
WaitHandles : array[0..1] of THandle;
207
193
if GetCurrentThreadID = MainThreadID then
208
while MsgWaitForMultipleObjects(1, FHandle, False, INFINITE, QS_SENDMESSAGE) = WAIT_OBJECT_0 + 1 do
209
PeekMessage(Msg, 0, 0, 0, PM_NOREMOVE)
195
WaitHandles[0]:=FHandle;
196
WaitHandles[1]:=THandle(SynchronizeTimeoutEvent);
199
case MsgWaitForMultipleObjects(2, WaitHandles, False, INFINITE, QS_SENDMESSAGE) of
205
PeekMessage(Msg, 0, 0, 0, PM_NOREMOVE)
211
210
WaitForSingleObject(ulong(FHandle), INFINITE);
212
211
GetExitCodeThread(FHandle, DWord(Result));
215
$Log: tthread.inc,v $
216
Revision 1.8 2005/02/25 21:52:07 florian
217
* "transfer to linux"-commit
219
Revision 1.7 2005/02/25 21:41:09 florian
220
* generic tthread.synchronize
221
* delphi compatible wakemainthread
223
Revision 1.6 2005/02/14 17:13:32 peter
226
Revision 1.5 2005/02/06 13:06:20 peter
227
* moved file and dir functions to sysfile/sysdir
228
* win32 thread in systemunit