stevegill
-
Content Count
3 -
Joined
-
Last visited
Posts posted by stevegill
-
-
35 minutes ago, Primož Gabrijelčič said:The first approach is OK. The second code fragment would not compile as the anonymous method in Await wouldn't know anything about RemindersDue and RemindersCount.
Thanks Primoz. Now that I've taken another look at the second code example it's pretty obvious.
In the first code snippet, if I dynamically created and destroyed database components in the Async part of the code, I'm assuming that they would be completely isolated from the main thread. Is that correct?
= Steve
-
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
Using Parameters with Async/Await.
in OmniThreadLibrary
Posted
Thanks Primoz!
I love the Omnithread library. It makes things a lot easier.
= Steve