mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-28 16:40:48 +02:00
* removed fpc thread manager dependancy, otherwise single-threaded applications fail with runtime error
git-svn-id: trunk@19558 -
This commit is contained in:
parent
838bb221d3
commit
4f1c322f14
@ -158,7 +158,27 @@ uses
|
||||
Spin, ExtCtrls, FileCtrl, LResources;
|
||||
|
||||
var
|
||||
FirstAppEventLock: pEventState = nil;
|
||||
FirstAppEventLock: MPEventID = nil;
|
||||
|
||||
const
|
||||
EventFlags : MPEventFlags = 1;
|
||||
|
||||
procedure SignalFirstAppEvent;
|
||||
begin
|
||||
MPSetEvent(FirstAppEventLock, EventFlags);
|
||||
end;
|
||||
|
||||
procedure WaitFirstAppEvent;
|
||||
var
|
||||
fl : MPEventFlags;
|
||||
begin
|
||||
fl := EventFlags;
|
||||
if FirstAppEventLock <> nil then
|
||||
begin
|
||||
MPWaitForEvent(FirstAppEventLock, @fl, kDurationForever);
|
||||
SignalFirstAppEvent;
|
||||
end;
|
||||
end;
|
||||
|
||||
// the implementation of the utility methods
|
||||
{$I carbonobject.inc}
|
||||
@ -170,14 +190,17 @@ var
|
||||
|
||||
procedure InternalInit;
|
||||
begin
|
||||
FirstAppEventLock:=BasicEventCreate(nil, true, false, '');
|
||||
MPCreateEvent(FirstAppEventLock);
|
||||
end;
|
||||
|
||||
procedure InternalFinal;
|
||||
begin
|
||||
basiceventSetEvent(FirstAppEventLock);
|
||||
basiceventdestroy(FirstAppEventLock);
|
||||
FirstAppEventLock:=nil;
|
||||
if Assigned(FirstAppEventLock) then
|
||||
begin
|
||||
SignalFirstAppEvent;
|
||||
MPDeleteEvent(FirstAppEventLock);
|
||||
FirstAppEventLock:=nil;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
|
@ -431,7 +431,7 @@ begin
|
||||
then
|
||||
RaiseGDBException('TCarbonWidgetSet.AppRun post dummy event failed');
|
||||
fMainEventQueue:=CurMainEventQueue;
|
||||
basiceventSetEvent(FirstAppEventLock);
|
||||
SignalFirstAppEvent;
|
||||
|
||||
RunApplicationEventLoop;
|
||||
finally
|
||||
@ -926,7 +926,7 @@ end;
|
||||
procedure TCarbonWidgetSet.OnWakeMainThread(Sender: TObject);
|
||||
begin
|
||||
// wait infinite for the first (dummy) event sent to the main event queue
|
||||
basiceventWaitFor(-1, FirstAppEventLock);
|
||||
WaitFirstAppEvent;
|
||||
SendCheckSynchronizeMessage;
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user