Thread with lock is working fine. TODO select