Hi Lennart: It seems mainloop is not thread safe. I'd like to cite time_free as example, pls correct me if I miss something. cleanup_time_events() simply iterates time_events list to free dead events and decrease time_events_please_scan. If there are three time events in list, #1, #2, #3, and cleanup_time_events() currently at #2 to check whether it is dead. Now another thread call time_free() on #1 which will increase time_events_please_scan. Then pa_assert(m->time_events_please_scan == 0); will fail when iteration ends in cleanup_time_events(). I didn't encounter this case but from code it exists in theory. Zhang Xin(Wing) Intel(SSG/OTC) ShangHai China