[cairo] Locking policy (and new cairo_hash_table interface)

Keith Packard keithp at keithp.com
Wed Jun 29 09:59:39 PDT 2005


On Wed, 2005-06-29 at 07:21 -0700, Carl Worth wrote:

> PS. Here's the new interface from cairo-hash-table-private.h. After
> I'd finished designing this, I checked glib and found I'd reinvented
> an interface almost identical to that of GHashTable. For the sake of
> those who are used to using that code, I've now renamed a couple of
> operations to reinforce that similarity (store->insert,
> iterate->foreach).

The basic API seems fine to me. It does require two passes over the hash
table on a miss (lookup, insert), but that doesn't seem an onerous price
to pay for a simple API.

One thing I don't quite understand -- if the hash table isn't
responsible for ejecting items, why are there 'delete' functions
provided?  Isn't the caller responsible for cleaning up the removed
objects when they call cairo_hash_table_remove?

Do you plan to construct a cache object on top of this simple hash
table? Or would you leave that to per-object code?

-keith

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.freedesktop.org/archives/cairo/attachments/20050629/0d62e095/attachment.pgp


More information about the cairo mailing list