Fix the trylock call, it returns 0 when the mutex is acquired.