[pulseaudio-discuss] Is mainloop thread safe?

Zhang, Xing Z xing.z.zhang at intel.com
Thu Apr 16 02:59:21 PDT 2009


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 




More information about the pulseaudio-discuss mailing list