Coroutines in thread API