Exemple #1
0
        internal static void HandleApiCall <T, B>(SteamAPICall_t call, CancellationToken token, Action <B, bool> handler)
        {
            if (token.IsCancellationRequested)
            {
                return;
            }

            CallResultHolder <B> .Set(call, (result, bIOFailure) => handler(result, bIOFailure));
        }
Exemple #2
0
        internal static Task <T> HandleApiCall <T, B>(SteamAPICall_t call, CancellationToken token, Action <TaskCompletionSource <T>, B, bool> handler)
        {
            return(TaskHelper.FromAction <T>(tsc =>
            {
                if (token.IsCancellationRequested)
                {
                    tsc.TrySetCanceled();
                    return;
                }

                CallResultHolder <B> .Set(call, (result, bIOFailure) => handler(tsc, result, bIOFailure));
                token.Register(() => tsc.TrySetCanceled());
            }));
        }
Exemple #3
0
 internal static void CancelApiCall <T>()
 {
     CallResultHolder <T> .Cancel();
 }