* removed fpc thread manager dependancy, otherwise single-threaded applications fail with runtime error

git-svn-id: trunk@19558 -
This commit is contained in:
dmitry 2009-04-21 15:02:28 +00:00
parent 838bb221d3
commit 4f1c322f14
2 changed files with 30 additions and 7 deletions

View File

@ -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;

View File

@ -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;