Exemplo n.º 1
0
 private static void CompleteTask <T>(TaskCompletionSource <T> tcs, FfiResult result, Func <T> argFunc)
 {
     if (result.ErrorCode != 0)
     {
         Task.Run(() => { tcs.SetException(result.ToException()); });
     }
     else
     {
         var arg = argFunc();
         Task.Run(() => { tcs.SetResult(arg); });
     }
 }
Exemplo n.º 2
0
 public static void CompleteTask(IntPtr userData, FfiResult result)
 => CompleteTask(userData, result, () => true);
Exemplo n.º 3
0
        public static void CompleteTask <T>(IntPtr userData, FfiResult result, Func <T> argFunc)
        {
            var tcs = FromHandlePtr <TaskCompletionSource <T> >(userData);

            CompleteTask(tcs, result, argFunc);
        }