replace g_mutex by pthread mutex in control.c