On 06/09/2011 12:12 PM, Henry Vermaak wrote:

Do you propose that QueueAsyncCall throws an exception if it's used from outside the main thread?
The purpose of QueueAsyncCall() is to use it in worker threads to notify the main thread of something that happens in the thread (without the worker thread needing to wait that the main thread was able to handle the event). But it's not forbidden to call QueueAsyncCall() in the main thread.
Otherwise adding a critical section to all the async queue methods is in order.

IMOH protecting a call to QueueAsyncCall() (in user code or <IMHO better> in the LCL itself) by a semaphore should not harm anyway in most cases, as there would be no waiting on anything else in that critical section. If you assign different priorities to the threads there of course is the usual problem of priority inversion.

-Michael

--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to