On 10/02/2014 05:03 PM, Xiangrong Fang wrote:



    For Windows, critical sections are lighter-weight than mutexes.
    Mutexes can be shared between processes, but always result in a
    system call to the kernel which has some overhead. Critical
    sections can only be used within one process, but have the
    advantage that they only switch to kernel mode in the case of
    contention.


I only need lock WITHIN my own application, so, it seems that critical sections are better.

So it seems that Windows in fact does a kind of FUTEX for inter-Thread synchronizing (as does pthredlib, that as it's name says just provides POSIX-operation within Threads, not between applications.)

Hence, provided TCrtiticalSections uses the Windows system DLL in Windows and the pthreadlib so in Linux, the resulting performance should be very similar.

-Michael
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to