[cairo] Review of: [cairo-mutex] Add a poor man's mutex implementation in case of CAIRO_NO_MUTEX

Behdad Esfahbod behdad at behdad.org
Mon Apr 23 14:47:13 PDT 2007


On Mon, 2007-04-23 at 17:38 -0400, Carl Worth wrote:
> On Sun, 22 Apr 2007 13:13:14 -0700 (PDT), wrote:
> > diff-tree ce91a176489f4cb8f40c5ec29f23881d1e013a9f (from 97b50e99bfa785d77b4900d3070f22a22827db22)
> > Author: Behdad Esfahbod <behdad at behdad.org>
> > Date:   Sun Apr 22 16:13:22 2007 -0400
> >
> >     [cairo-mutex] Add a poor man's mutex implementation in case of CAIRO_NO_MUTEX
> >     just for fun.
> 
> > +# define CAIRO_MUTEX_INITIALIZE() CAIRO_MUTEX_NOOP
> > +# define CAIRO_MUTEX_LOCK(name) do { while (name) ; (name) = 1; } while (0)
> > +# define CAIRO_MUTEX_UNLOCK(name) (name) = 0
> > +# define CAIRO_MUTEX_NIL_INITIALIZER 0
> 
> Now that you've had your fun, can we just remove this code?

Oops.  Was too late on IRC to prevent you reviewing this :).


> It's only going to get compiled in the case of CAIRO_NO_MUTEX, right?

Right.

> In which case it's pointless to do anything.
> 
> And even in spite of that, it's *really* pointless to have something
> named "mutex" that doesn't actually implement mutual exclusion.

Yeah, but it should still compile.   That is, for example, typedef void
cairo_mutex_t doesn't work.

> Yuck.
> 
> -Carl
-- 
behdad
http://behdad.org/

"Those who would give up Essential Liberty to purchase a little
 Temporary Safety, deserve neither Liberty nor Safety."
        -- Benjamin Franklin, 1759





More information about the cairo mailing list