comparison Implab/Safe.cs @ 213:9ee78a345738 v2

Minor code changes
author cin
date Tue, 11 Apr 2017 01:35:18 +0300
parents a867536c68fc
children fe5101083150
comparison
equal deleted inserted replaced
212:a01d9df88d74 213:9ee78a345738
3 using System.Linq; 3 using System.Linq;
4 using System.Text; 4 using System.Text;
5 using System.Text.RegularExpressions; 5 using System.Text.RegularExpressions;
6 using System.Diagnostics; 6 using System.Diagnostics;
7 using System.Collections; 7 using System.Collections;
8
9 #if NET_4_5
10 using System.Threading.Tasks;
11 #endif
8 12
9 namespace Implab 13 namespace Implab
10 { 14 {
11 public static class Safe 15 public static class Safe
12 { 16 {
115 } catch (Exception err) { 119 } catch (Exception err) {
116 return new FailedPromise(err); 120 return new FailedPromise(err);
117 } 121 }
118 } 122 }
119 123
124 public static void NoWait(IPromise promise) {
125 }
126
120 [DebuggerStepThrough] 127 [DebuggerStepThrough]
121 public static IPromise<T> Run<T>(Func<IPromise<T>> action) { 128 public static IPromise<T> Run<T>(Func<IPromise<T>> action) {
122 ArgumentNotNull(action, "action"); 129 ArgumentNotNull(action, "action");
123 130
124 try { 131 try {
126 } catch (Exception err) { 133 } catch (Exception err) {
127 return Promise<T>.FromException(err); 134 return Promise<T>.FromException(err);
128 } 135 }
129 } 136 }
130 137
138 #if NET_4_5
139 public static void NoWait(Task t) {
140 }
141 #endif
142
131 } 143 }
132 } 144 }