mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-12 12:05:57 +02:00
* generic tthread.synchronize
* delphi compatible wakemainthread
This commit is contained in:
parent
04b1263e7f
commit
44b332f82a
@ -279,10 +279,6 @@ begin
|
||||
Result := I;
|
||||
end;
|
||||
|
||||
procedure TThread.Synchronize(Method: TThreadMethod);
|
||||
begin
|
||||
{$TODO someone with more clue of the GUI stuff will have to do this}
|
||||
end;
|
||||
|
||||
procedure TThread.SetPriority(Value: TThreadPriority);
|
||||
begin
|
||||
@ -291,7 +287,11 @@ end;
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.4 2005-02-14 17:13:22 peter
|
||||
Revision 1.5 2005-02-25 21:41:09 florian
|
||||
* generic tthread.synchronize
|
||||
* delphi compatible wakemainthread
|
||||
|
||||
Revision 1.4 2005/02/14 17:13:22 peter
|
||||
* truncate log
|
||||
|
||||
}
|
||||
|
@ -243,16 +243,6 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
procedure TThread.Synchronize(Method: TThreadMethod);
|
||||
begin
|
||||
FSynchronizeException := nil;
|
||||
FMethod := Method;
|
||||
{ SendMessage(ThreadWindow, CM_EXECPROC, 0, Longint(Self)); }
|
||||
if Assigned(FSynchronizeException) then
|
||||
raise FSynchronizeException;
|
||||
end;
|
||||
|
||||
|
||||
procedure TThread.SetSuspended(Value: Boolean);
|
||||
begin
|
||||
if Value <> FSuspended then
|
||||
@ -593,28 +583,6 @@ begin
|
||||
Result := I;
|
||||
end;
|
||||
|
||||
procedure TThread.Synchronize(Method: TThreadMethod);
|
||||
var
|
||||
LocalSyncException: Exception;
|
||||
begin
|
||||
if SynchronizeMethodProc = nil then
|
||||
{ raise some error? }
|
||||
exit;
|
||||
rtleventsync(trtlmethod(method),synchronizemethodproc);
|
||||
{
|
||||
EnterCriticalSection(SynchronizeCritSect);
|
||||
SynchronizeMethod := Method;
|
||||
SynchronizeException := nil;
|
||||
SynchronizeMethodProc;
|
||||
// wait infinitely
|
||||
RtlEventWaitFor(ExecuteEvent);
|
||||
SynchronizeMethod := nil;
|
||||
LocalSyncException := SynchronizeException;
|
||||
LeaveCriticalSection(SynchronizeCritSect);
|
||||
if LocalSyncException <> nil then
|
||||
raise LocalSyncException;
|
||||
}
|
||||
end;
|
||||
|
||||
procedure TThread.SetPriority(Value: TThreadPriority);
|
||||
begin
|
||||
@ -624,7 +592,11 @@ end;
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.13 2005-02-14 17:13:22 peter
|
||||
Revision 1.14 2005-02-25 21:41:09 florian
|
||||
* generic tthread.synchronize
|
||||
* delphi compatible wakemainthread
|
||||
|
||||
Revision 1.13 2005/02/14 17:13:22 peter
|
||||
* truncate log
|
||||
|
||||
Revision 1.12 2005/02/06 12:16:52 peter
|
||||
|
@ -47,12 +47,6 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
procedure TThread.Synchronize(Method: TThreadMethod);
|
||||
|
||||
begin
|
||||
end;
|
||||
|
||||
|
||||
constructor TThread.Create(CreateSuspended: Boolean);
|
||||
|
||||
begin
|
||||
@ -93,7 +87,11 @@ end;
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.2 2005-02-14 17:13:22 peter
|
||||
Revision 1.3 2005-02-25 21:41:09 florian
|
||||
* generic tthread.synchronize
|
||||
* delphi compatible wakemainthread
|
||||
|
||||
Revision 1.2 2005/02/14 17:13:22 peter
|
||||
* truncate log
|
||||
|
||||
}
|
||||
|
@ -313,15 +313,6 @@ begin
|
||||
Result := I;
|
||||
end;
|
||||
|
||||
procedure TThread.Synchronize(Method: TThreadMethod);
|
||||
var
|
||||
LocalSyncException: Exception;
|
||||
begin
|
||||
if SynchronizeMethodProc = nil then
|
||||
{ raise some error? }
|
||||
exit;
|
||||
rtleventsync(trtlmethod(method),synchronizemethodproc);
|
||||
end;
|
||||
|
||||
procedure TThread.SetPriority(Value: TThreadPriority);
|
||||
begin
|
||||
@ -330,7 +321,11 @@ end;
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.12 2005-02-14 17:13:30 peter
|
||||
Revision 1.13 2005-02-25 21:41:09 florian
|
||||
* generic tthread.synchronize
|
||||
* delphi compatible wakemainthread
|
||||
|
||||
Revision 1.12 2005/02/14 17:13:30 peter
|
||||
* truncate log
|
||||
|
||||
Revision 1.11 2005/02/06 11:20:52 peter
|
||||
|
@ -92,11 +92,6 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
procedure TThread.Synchronize(Method: TThreadMethod);
|
||||
begin
|
||||
end;
|
||||
|
||||
|
||||
function ThreadProc(Args: pointer): Integer; cdecl;
|
||||
var
|
||||
FreeThread: Boolean;
|
||||
@ -183,7 +178,11 @@ end;
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.2 2005-02-14 17:13:30 peter
|
||||
Revision 1.3 2005-02-25 21:41:09 florian
|
||||
* generic tthread.synchronize
|
||||
* delphi compatible wakemainthread
|
||||
|
||||
Revision 1.2 2005/02/14 17:13:30 peter
|
||||
* truncate log
|
||||
|
||||
}
|
||||
|
@ -243,16 +243,6 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
procedure TThread.Synchronize(Method: TThreadMethod);
|
||||
begin
|
||||
FSynchronizeException := nil;
|
||||
FMethod := Method;
|
||||
{ SendMessage(ThreadWindow, CM_EXECPROC, 0, Longint(Self)); }
|
||||
if Assigned(FSynchronizeException) then
|
||||
raise FSynchronizeException;
|
||||
end;
|
||||
|
||||
|
||||
procedure TThread.SetSuspended(Value: Boolean);
|
||||
begin
|
||||
if Value <> FSuspended then
|
||||
@ -593,10 +583,6 @@ begin
|
||||
Result := I;
|
||||
end;
|
||||
|
||||
procedure TThread.Synchronize(Method: TThreadMethod);
|
||||
begin
|
||||
{$TODO someone with more clue of the GUI stuff will have to do this}
|
||||
end;
|
||||
|
||||
procedure TThread.SetPriority(Value: TThreadPriority);
|
||||
begin
|
||||
@ -606,7 +592,11 @@ end;
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.3 2005-02-14 17:13:30 peter
|
||||
Revision 1.4 2005-02-25 21:41:09 florian
|
||||
* generic tthread.synchronize
|
||||
* delphi compatible wakemainthread
|
||||
|
||||
Revision 1.3 2005/02/14 17:13:30 peter
|
||||
* truncate log
|
||||
|
||||
}
|
||||
|
@ -217,19 +217,6 @@ begin
|
||||
ThreadSetPriority(FHandle, Priorities[Value]);
|
||||
end;
|
||||
|
||||
{does not make sense for netware}
|
||||
procedure TThread.Synchronize(Method: TThreadMethod);
|
||||
begin
|
||||
(*
|
||||
FSynchronizeException := nil;
|
||||
FMethod := Method;
|
||||
{ SendMessage(ThreadWindow, CM_EXECPROC, 0, Longint(Self)); }
|
||||
{$warning Synchronize needs implementation}
|
||||
if Assigned(FSynchronizeException) then
|
||||
raise FSynchronizeException;
|
||||
*)
|
||||
end;
|
||||
|
||||
|
||||
procedure TThread.SetSuspended(Value: Boolean);
|
||||
begin
|
||||
@ -271,7 +258,11 @@ end;
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.4 2005-02-14 17:13:30 peter
|
||||
Revision 1.5 2005-02-25 21:41:09 florian
|
||||
* generic tthread.synchronize
|
||||
* delphi compatible wakemainthread
|
||||
|
||||
Revision 1.4 2005/02/14 17:13:30 peter
|
||||
* truncate log
|
||||
|
||||
}
|
||||
|
@ -392,9 +392,6 @@ begin
|
||||
Result := I;
|
||||
end;
|
||||
|
||||
procedure TThread.Synchronize(Method: TThreadMethod);
|
||||
begin
|
||||
end;
|
||||
|
||||
procedure TThread.SetPriority(Value: TThreadPriority);
|
||||
begin
|
||||
@ -403,7 +400,11 @@ end;
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.3 2005-02-14 17:13:30 peter
|
||||
Revision 1.4 2005-02-25 21:41:09 florian
|
||||
* generic tthread.synchronize
|
||||
* delphi compatible wakemainthread
|
||||
|
||||
Revision 1.3 2005/02/14 17:13:30 peter
|
||||
* truncate log
|
||||
|
||||
}
|
||||
|
@ -243,16 +243,6 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
procedure TThread.Synchronize(Method: TThreadMethod);
|
||||
begin
|
||||
FSynchronizeException := nil;
|
||||
FMethod := Method;
|
||||
{ SendMessage(ThreadWindow, CM_EXECPROC, 0, Longint(Self)); }
|
||||
if Assigned(FSynchronizeException) then
|
||||
raise FSynchronizeException;
|
||||
end;
|
||||
|
||||
|
||||
procedure TThread.SetSuspended(Value: Boolean);
|
||||
begin
|
||||
if Value <> FSuspended then
|
||||
@ -593,10 +583,6 @@ begin
|
||||
Result := I;
|
||||
end;
|
||||
|
||||
procedure TThread.Synchronize(Method: TThreadMethod);
|
||||
begin
|
||||
{$TODO someone with more clue of the GUI stuff will have to do this}
|
||||
end;
|
||||
|
||||
procedure TThread.SetPriority(Value: TThreadPriority);
|
||||
begin
|
||||
@ -606,7 +592,11 @@ end;
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.3 2005-02-14 17:13:31 peter
|
||||
Revision 1.4 2005-02-25 21:41:09 florian
|
||||
* generic tthread.synchronize
|
||||
* delphi compatible wakemainthread
|
||||
|
||||
Revision 1.3 2005/02/14 17:13:31 peter
|
||||
* truncate log
|
||||
|
||||
}
|
||||
|
@ -156,11 +156,6 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
procedure TThread.Synchronize(Method: TThreadMethod);
|
||||
begin
|
||||
end;
|
||||
|
||||
|
||||
function ThreadProc(Args: pointer): Integer; cdecl;
|
||||
var
|
||||
FreeThread: Boolean;
|
||||
@ -241,7 +236,11 @@ end;
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.5 2005-02-14 17:13:31 peter
|
||||
Revision 1.6 2005-02-25 21:41:09 florian
|
||||
* generic tthread.synchronize
|
||||
* delphi compatible wakemainthread
|
||||
|
||||
Revision 1.5 2005/02/14 17:13:31 peter
|
||||
* truncate log
|
||||
|
||||
}
|
||||
|
@ -183,50 +183,6 @@ begin
|
||||
SetThreadPriority(FHandle, Priorities[Value]);
|
||||
end;
|
||||
|
||||
{ old implementation? :
|
||||
procedure TThread.Synchronize(Method: TThreadMethod);
|
||||
begin
|
||||
FSynchronizeException := nil;
|
||||
FMethod := Method;
|
||||
SendMessage(ThreadWindow, CM_EXECPROC, 0, Longint(Self));
|
||||
if Assigned(FSynchronizeException) then raise FSynchronizeException;
|
||||
end;
|
||||
}
|
||||
|
||||
procedure TThread.Synchronize(Method: TThreadMethod);
|
||||
var
|
||||
LocalSyncException: Exception;
|
||||
begin
|
||||
if SynchronizeMethodProc = nil then
|
||||
{ raise some error? }
|
||||
exit;
|
||||
|
||||
EnterCriticalSection(SynchronizeCritSect);
|
||||
SynchronizeMethod := Method;
|
||||
SynchronizeException := nil;
|
||||
SynchronizeMethodProc;
|
||||
// wait infinitely
|
||||
RtlEventWaitFor(ExecuteEvent);
|
||||
SynchronizeMethod := nil;
|
||||
LocalSyncException := SynchronizeException;
|
||||
LeaveCriticalSection(SynchronizeCritSect);
|
||||
if LocalSyncException <> nil then
|
||||
raise LocalSyncException;
|
||||
end;
|
||||
|
||||
procedure CheckSynchronize;
|
||||
{ assumes being called from GUI thread }
|
||||
begin
|
||||
if SynchronizeMethod = nil then
|
||||
exit;
|
||||
|
||||
try
|
||||
SynchronizeMethod;
|
||||
except
|
||||
SynchronizeException := Exception(AcquireExceptionObject);
|
||||
end;
|
||||
RtlEventSetEvent(ExecuteEvent);
|
||||
end;
|
||||
|
||||
procedure TThread.SetSuspended(Value: Boolean);
|
||||
begin
|
||||
@ -265,7 +221,11 @@ begin
|
||||
end;
|
||||
{
|
||||
$Log$
|
||||
Revision 1.6 2005-02-14 17:13:32 peter
|
||||
Revision 1.7 2005-02-25 21:41:09 florian
|
||||
* generic tthread.synchronize
|
||||
* delphi compatible wakemainthread
|
||||
|
||||
Revision 1.6 2005/02/14 17:13:32 peter
|
||||
* truncate log
|
||||
|
||||
Revision 1.5 2005/02/06 13:06:20 peter
|
||||
|
Loading…
Reference in New Issue
Block a user