On 02/09/2012 10:53 AM, Antonio Fortuny wrote:


I've made a test on Win32 and the TEventObject is blocking system wide.
Great !

If this feature is really usable on all platforms, the documentation needs to be updated accordingly.

AFAIK:

System wide inter-process semaphores should be a lot slower than in-process inter-thread semaphores. With inter-Thread sync, for 99,99% of the calls, expensive OS-Calls (and thus context switches) can be avoided.

On Linux, there is FUTEX vs. MUTEX (I did a lot of research on this issue). Regarding Lazarus, for inter-Thread stuff (TCriticalSection and friends) Lazarus uses the pthread library which in fact does FUTEX (if available for the architecture it runs on, MUTEX otherwise). AFAIK, Windows also provides dedicated fast inter-thread mechanisms.

Thus it does make sense to use TCriticalSection for inter-thread stuff and those SyncOBJ functions, that are documented to be usable for inter-Process work, when necessary.

-Michael

--
_______________________________________________
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to