Please enable JavaScript to use RhodeCode Enterprise
##// END OF EJS Templates
cin
- Fri, 14 Nov 2014 11:04:24
Show More
0
Implab/Diagnostics/ConsoleTraceListener.cs
Implab/Diagnostics/ConsoleTraceListener.cs
+1
-1
@@
-26,7
+26,7
namespace Implab.Diagnostics {
26
26
msg . AppendFormat ( "[{0}]:{1}: {2}" , args . ThreadId , channel , text . content );
27
27
28
28
lock ( _consoleLock ) {
29
Console . ForegroundColor = ( ConsoleColor )( args . ThreadId % 15 + 1 );
29
// Console.ForegroundColor = (ConsoleColor)(args.ThreadId % 15 + 1);
30
30
Console . WriteLine ( msg );
31
31
}
32
32
}
0
Implab/Diagnostics/Extensions.cs
Implab/Diagnostics/Extensions.cs
+19
-2
@@
-4,11
+4,28
4
4
Safe . ArgumentNotNull ( promise , "promise" );
5
5
var op = TraceContext . Instance . DetachLogicalOperation ();
6
6
7
return promise . Anyway(() => {
7
return promise . Then < T > (
8
x => {
8
9
TraceContext . Instance . EnterLogicalOperation ( op , true );
10
TraceLog . TraceInformation ( "promise = {0}" , x );
9
11
TraceLog . EndLogicalOperation ();
10
12
TraceContext . Instance . Leave ();
11
});
13
return x ;
14
},
15
err =>{
16
TraceContext . Instance . EnterLogicalOperation ( op , true );
17
TraceLog . TraceError ( "promise died {0}" , err );
18
TraceLog . EndLogicalOperation ();
19
TraceContext . Instance . Leave ();
20
throw new TransientPromiseException ( err );
21
},
22
() => {
23
TraceContext . Instance . EnterLogicalOperation ( op , true );
24
TraceLog . TraceInformation ( "promise cancelled" );
25
TraceLog . EndLogicalOperation ();
26
TraceContext . Instance . Leave ();
27
}
28
);
12
29
}
13
30
14
31
public static IPromise EndLogicalOperation ( this IPromise promise ) {
0
Implab/PromiseExtensions.cs
Implab/PromiseExtensions.cs
+7
0
@@
-1,5
+1,8
1
1
using System.Threading ;
2
2
using System ;
3
using Implab.Diagnostics ;
4
5
3
6
#if NET_4_5
4
7
using System.Threading.Tasks ;
5
8
#endif
@@
-57,11
+60,15
namespace Implab {
57
60
public static AsyncCallback AsyncCallback < T >( this Promise < T > that , Func < IAsyncResult , T > callback ) {
58
61
Safe . ArgumentNotNull ( that , "that" );
59
62
Safe . ArgumentNotNull ( callback , "callback" );
63
var op = TraceContext . Instance . CurrentOperation ;
60
64
return ar => {
65
TraceContext . Instance . EnterLogicalOperation ( op , false );
61
66
try {
62
67
that . Resolve ( callback ( ar ));
63
68
} catch ( Exception err ) {
64
69
that . Reject ( err );
70
} finally {
71
TraceContext . Instance . Leave ();
65
72
}
66
73
};
67
74
}
Site-wide shortcuts
/
Use quick search box
g h
Goto home page
g g
Goto my private gists page
g G
Goto my public gists page
g 0-9
Goto bookmarked items from 0-9
n r
New repository page
n g
New gist page
Repositories
g s
Goto summary page
g c
Goto changelog page
g f
Goto files page
g F
Goto files page with file search activated
g p
Goto pull requests page
g o
Goto repository settings
g O
Goto repository access permissions settings
t s
Toggle sidebar on some pages