Using TaskCompletionSource to synchronize callbacks