Use cppumock for critical sections.

This allows for easier testing.