The approach here is lifted from glib I think, so you could see how they solve it or if they have the same problem and also why they don't use pthread builtin recursive locks. Havoc