pthread_mutex_lock, then increase counter