Replying to myself. On Mon, Mar 28, 2011 at 12:21 PM, Daniel Mack <zonque at gmail.com> wrote: > As this seems so obvious, and the code has been around for some years, > I wonder whether I miss anything obvious here. Is there any mutex > (which doesn't work yet on OS X) that should protect the mainloop from > this race? I attached a patch ready to fix this issue for me, but I'm > not sure whether there is more code left which fails for similar > assumptions. Forget about this patch. My assumption of what the threaded mainloop API is in charge for was wrong. There is only one single execution path in the whole thing and the API is not thread safe. The documentation also states that. So I need to dig deeper. Sorry for the confusion. Daniel