[cairo] Atomic operations under Windows

cu cairouser at yahoo.com
Mon Mar 15 08:48:21 PDT 2010


Dear all,

 I wonder if anyone had any success using Windows InterlockedExchange
functions to implement atomic operations support with any success? Is it
even worth doing - i.e. would there be a measurable speed improvement
using these vs. using mutexes in generic atomic code?

I tried the "naive" replacement of Intel/GCC "sync_*" functions with
reasonable Windows counterparts - but that causes my test application to
crash instantly when trying to use Cairo. It crashes in such a way that
makes using Visual  C debugger impossible - so I can't go a whole lot
further.

It does seem as though whatever causes the crash is not
InterlockedExchange functions themselves. I used generic Cairo atomic
operations while still defining HAS_ATOMIC_OPS - and get the same crash
behavior (non-debugable, for me anyway).  Since I cant' entirely figure
out what else atomic operations would affect - any help in figuring this
out would be appreciated.

As an aside, some of the code predicated on "atomic operations" includes
use of functions ffs() and lround() not available under Windows. They
are not hard to substitute - just something to keep in mind.





More information about the cairo mailing list