I'm using Async and Await with two methods.
The CheckForDueRemindersProcess method has two var parameters. The intention is to run this in a thread and receive the values via the parameters.
The values are then passed to the CheckForDueReminderFinish method, which updates VCL components.
Is the following code the correct way to do this?
var
RemindersDue: Boolean;
RemindersCount: integer;
begin
Async(procedure
begin
CheckForDueRemindersProcess(RemindersDue, RemindersCount);
end).Await(procedure
begin
CheckForDueRemindersFinish(RemindersDue, RemindersCount);
end);
end;
Another question: is it ok to declare the variables as shown above in the calling method, or should they be declared like this:
Async(procedure
var
RemindersDue: Boolean;
RemindersCount: integer;
begin
CheckForDueRemindersProcess(RemindersDue, RemindersCount);
end).Await(procedure
begin
CheckForDueRemindersFinish(RemindersDue, RemindersCount);
end);
Thanks.
= Steve