##// END OF EJS Templates
sync, minor changes
cin -
r284:bcb6c16f6fed v3
parent child
Show More

The requested changes are too big and content was truncated. Show full diff

@@ -1,6 +1,7
1 1 using System;
2 2 using System.Collections.Generic;
3 3 using System.Diagnostics;
4 using System.Dynamic;
4 5 using System.Linq;
5 6 using Implab.Components;
6 7 using Implab.Diagnostics;
@@ -91,11 +92,13 namespace Implab.Playground {
91 92 static void Main(string[] args) {
92 93 var u1 = new Uri("/some/one");
93 94
94 Console.WriteLine($"{u1.IsAbsoluteUri}: {u1}");
95 dynamic obj = new ExpandoObject();
96
97 obj.Name = "Dynamo";
95 98
96 var u2 = new Uri(u1, "../../two");
99 obj.Hello = new Func<string>(() => { return "Hello"; });
97 100
98 Console.WriteLine($"{u2.IsAbsoluteUri}: {u2}");
101 Console.WriteLine($"{obj.Hello()}");
99 102
100 103 }
101 104
1 NO CONTENT: file renamed from Implab.ServiceHost/docs/XmlConfiguration.md to Implab.ServiceHost/docs/XmlConfiguration.ru.md
@@ -46,6 +46,10 namespace Implab.Components {
46 46
47 47 protected override async Task StopInternalAsync(CancellationToken ct) {
48 48 // component in Stopping state, no new polls will be scheduled
49
50 // we do not need additional synchronization logic here
51 // since RunnableComponent already done this
52
49 53 m_cancellation.Cancel();
50 54 try {
51 55 // await for pending poll
@@ -59,7 +63,10 namespace Implab.Components {
59 63 protected abstract Task Poll(CancellationToken ct);
60 64
61 65 void ScheduleNextPoll(int timeout) {
66 // access and modification of the component state
67 // in custom methods requires a synchronization
62 68 lock (SynchronizationObject) {
69
63 70 if (State == ExecutionState.Running) {
64 71 m_pending = Safe.CreateTask(m_cancellation.Token);
65 72 m_poll = m_pending.Then(() => Poll(m_cancellation.Token));
@@ -70,10 +77,16 namespace Implab.Components {
70 77
71 78 async void OnTimer(object state) {
72 79 try {
80 // changes to m_pending and m_poll are done
81 // only in ScheduleNextPoll method, hence we
82 // can safely use them here
73 83 m_pending.Start();
74 84 await m_poll;
85
86 // schedule next poll
75 87 ScheduleNextPoll(Interval);
76 88 } catch (Exception e) {
89 // hanle error
77 90 UnhandledException.DispatchEvent(this, new UnhandledExceptionEventArgs(e, false));
78 91
79 92 if (FailOnError)
1 NO CONTENT: file was removed
The requested commit or file is too big and content was truncated. Show full diff
General Comments 3
Under Review
author

Auto status change to "Under Review"

Approved
author

ok, latest stable version should be in default

You need to be logged in to leave comments. Login now