mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-15 09:49:14 +02:00
--- Merging r40651 into '.':
U rtl/objpas/classes/classes.inc --- Recording mergeinfo for merge of r40651 into '.': U . # revisions: 40651 git-svn-id: branches/fixes_3_2@40688 -
This commit is contained in:
parent
7bcb8e911c
commit
da5c47ee16
@ -299,6 +299,9 @@ end;
|
|||||||
|
|
||||||
|
|
||||||
procedure ThreadQueueAppend(aEntry: TThread.PThreadQueueEntry; aQueueIfMain: Boolean);
|
procedure ThreadQueueAppend(aEntry: TThread.PThreadQueueEntry; aQueueIfMain: Boolean);
|
||||||
|
var
|
||||||
|
thd: TThread;
|
||||||
|
issync: Boolean;
|
||||||
begin
|
begin
|
||||||
{ do we really need a synchronized call? }
|
{ do we really need a synchronized call? }
|
||||||
{$ifdef FPC_HAS_FEATURE_THREADING}
|
{$ifdef FPC_HAS_FEATURE_THREADING}
|
||||||
@ -310,6 +313,14 @@ begin
|
|||||||
Dispose(aEntry);
|
Dispose(aEntry);
|
||||||
{$ifdef FPC_HAS_FEATURE_THREADING}
|
{$ifdef FPC_HAS_FEATURE_THREADING}
|
||||||
end else begin
|
end else begin
|
||||||
|
{ store thread and whether we're dealing with a synchronized event; the
|
||||||
|
event record itself might already be freed after the ThreadQueueLock is
|
||||||
|
released (in case of a Queue() call; for a Synchronize() call the record
|
||||||
|
will stay valid, thus accessing SyncEvent later on (if issync is true) is
|
||||||
|
okay) }
|
||||||
|
thd := aEntry^.Thread;
|
||||||
|
issync := Assigned(aEntry^.SyncEvent);
|
||||||
|
|
||||||
System.EnterCriticalSection(ThreadQueueLock);
|
System.EnterCriticalSection(ThreadQueueLock);
|
||||||
try
|
try
|
||||||
{ add the entry to the thread queue }
|
{ add the entry to the thread queue }
|
||||||
@ -325,10 +336,10 @@ begin
|
|||||||
{ ensure that the main thread knows that something awaits }
|
{ ensure that the main thread knows that something awaits }
|
||||||
RtlEventSetEvent(SynchronizeTimeoutEvent);
|
RtlEventSetEvent(SynchronizeTimeoutEvent);
|
||||||
if assigned(WakeMainThread) then
|
if assigned(WakeMainThread) then
|
||||||
WakeMainThread(aEntry^.Thread);
|
WakeMainThread(thd);
|
||||||
|
|
||||||
{ is this a Synchronize or Queue entry? }
|
{ is this a Synchronize or Queue entry? }
|
||||||
if Assigned(aEntry^.SyncEvent) then begin
|
if issync then begin
|
||||||
RtlEventWaitFor(aEntry^.SyncEvent);
|
RtlEventWaitFor(aEntry^.SyncEvent);
|
||||||
if Assigned(aEntry^.Exception) then
|
if Assigned(aEntry^.Exception) then
|
||||||
raise aEntry^.Exception;
|
raise aEntry^.Exception;
|
||||||
|
Loading…
Reference in New Issue
Block a user