2006/11/14, Alexandre Leclerc <[EMAIL PROTECTED]>:
Hi all,

I see that when using Application.QueueAsyncCall the functions are not
call in the order they have been put Async... Actually I see that they
are called completely in reverse order.

Is there a way to make sure it is call in the order it has been put Async?

Well, we could change the calling logic... but is there a will for such a thing?

I see why it is doing so (see above the 'next' is actually the
previous in the order). And only the last item is known. We could do
the reverse contrary:
- Keep pointer of the first
- Keep pointer of the last
- If there is a new element added, chain it after the last one.
- When emptying the queue, start with the first.
- Change the logic so that 'next item' is really next item.

Just say 'ok' and I send a patch right after.

Regards.

//Actual procedure:

procedure TApplication.QueueAsyncCall(AMethod: TDataEvent; Data: PtrInt);
var
 lItem: PAsyncCallQueueItem;
begin
 if AppDoNotCallAsyncQueue in FFlags then
   raise Exception.Create('TApplication.QueueAsyncCall already shut down');
 New(lItem);
 lItem^.Method := AMethod;
 lItem^.Data := Data;
 lItem^.NextItem := FAsyncCallQueue;
 FAsyncCallQueue := lItem;
end;

--
Alexandre Leclerc

_________________________________________________________________
    To unsubscribe: mail [EMAIL PROTECTED] with
               "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to