This is something I was looking for and someone just released a project that seems to perfectly do the trick, so let’s share it.
Transaction Kit is a C library that provides key / value based hash tables and was designed to fill the gap between simple, lightweight key / value type primitives and the more advanced features available in heavyweight databases.
Multithreading programming often requires many of the qualities that database transactions provide but could do without all the extra overhead associated with using a full featured database. Programs often need to share data among threads that is short lived and transitory in nature, rarely extending beyond a programs execution lifetime. TransactionKit fills that need, providing database like transactions for simple key / value pairs of data. The design of TransactionKit is completely lockless and only requires commonly available atomic primitives, such as single word Compare and Swap.
(blurb from the official web site, I feel lazy).