Typical solution is a queue to hold L1, l2 tuples, and then .synchronize a method that drains the queue.
Interesting. Is this an existing feature in FPC/Lazarus?
Not in its totality, but the necessary building blocks are there.
It is exactly right. Anonymous methods are only supported in the development version trunk/main
Typical solution is a queue to hold L1, l2 tuples, and then .synchronize a method that drains the queue.
Why not simply put L1 and L2 into unit level?
What if you have multiple threads or multiple invocations of
DoSomethingInBackgroundThread? In context of threading global variables are nearly always the wrong answer.