[fpc-devel] Why FreeBSD sem_init() works different to Linux?

Jonas Maebe jonas.maebe at elis.ugent.be
Thu Feb 7 13:46:39 CET 2013


On 07 Feb 2013, at 13:39, Ewald wrote:

> Well, I always thought that the InterLoackedCompareExchange boiles  
> down
> to [**]
> .Lock CMPXCHG
>
> Or something quite like that. The `.Lock` there is the important part
> since this does insure a memory barier.

It's only a memory barrier if you don't use SSE (or write-combined  
memory, but that's generally only the case for memory mapped video  
memory or so, and more of an issue for kernel mode code than for user  
space). Furthermore, FPC supports many more architectures than just  
x86, and on (virtually?) all other platforms the instructions for  
atomic accesses do not automatically imply any kind of memory barrier.


Jonas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20130207/fa14b62d/attachment.html>


More information about the fpc-devel mailing list