[Pixman] Valgrind-clean pixman

Siarhei Siamashka siarhei.siamashka at gmail.com
Sat Aug 28 08:34:48 PDT 2010

On Saturday 28 August 2010 12:21:52 Andrea Canciani wrote:
> On Fri, Aug 27, 2010 at 3:58 PM, Siarhei Siamashka wrote:
> > This code which is setting a global implementation pointer is also not
> > quite thread safe (though very unlikely to cause any practical problems
> > other than a bit bigger one time memory leak). I did not look at it in
> > details, but with your changes for the use of static structures, it may
> > become a bit worse because two or more concurrent threads now can
> > potentially try to initialize the same data structures at once when
> > setting up implementation pointer.
> Pixman is not thread safe right now (reference counting, in particular).
> When we fix (probably by using atomics) reference count, it should be very
> easy to make implementations thread safe, too.

I may be wrong here, but seems like everyone has his own definition of what is 
considered to be "thread safe". Currently pixman appears to be thread safe as 
long as same pixman objects (pixman_image_t and the others) are not used from 
multiple threads simultaneously. This is somewhat similar to the thread safety 
assumptions of the GNU implementation of a standard C++ template library. I'm 
adding this link here because they took care of documenting what can be 
guaranteed when working in a multi-threaded environment, and what can't be:

> I'm working on a library of simple inline functions (based on cairo
> atomic and mutex implementations) to share some common utility functions
> which have different availability on different platforms (right now: atomics,
> wideint, mutexes). I hope to make it available soon (after I get autotools
> do the right things to make it work).

Sounds nice, but also a bit scary at the same time. Let's hope that pixman is 
not going to become a performance disaster like gstreamer due to adding extra 
thread safety guarantees ;)
Best regards,
Siarhei Siamashka
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/pixman/attachments/20100828/4ffb2b6d/attachment.pgp>

More information about the Pixman mailing list