Steven,

>Yes there are threads involved.<

Have you considered using a mutex or semaphore? This guarantees thread safe
queueing of event processing (waiting threads sleep until OS ready for them
to run - no polling). I would use a mutex as your requirement is for single
thread execution. The code is (very roughly) ...

var
  MHandle : THandle;

procedure OnCreate;
begin
     MHandle:=CreateMutex (nil,false,'MyMutexName');
end;

procedure OnDestroy;
begin
     CloseHandle (HMutex);
end;

procedure MyEventHandler;
begin
       WaitForSingleObject (MHandle, INFINITE);
       Do your single-thread-only stufff here ...
       ReleaseMutex (MHandle);
end;

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

Reply via email to