Add locks to proto listeners and improve the API to allow to specify a filter when registering a listener.