summaryrefslogtreecommitdiff
path: root/product/service.infrastructure/threading/SynchronousCommandProcessor.cs
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2009-10-23 13:09:04 -0600
committermo khan <mo@mokhan.ca>2009-10-23 13:09:04 -0600
commit9a3430b2a1f0445c0dbac703907762e225383421 (patch)
tree751d5742a199eae57ebb6d767e650bd6c803bdc3 /product/service.infrastructure/threading/SynchronousCommandProcessor.cs
parentf76fe6ca01f3dc5fabc8bf16f299420ba9d7ef05 (diff)
renamed some components to something that is more descriptive.main
Diffstat (limited to 'product/service.infrastructure/threading/SynchronousCommandProcessor.cs')
-rw-r--r--product/service.infrastructure/threading/SynchronousCommandProcessor.cs37
1 files changed, 37 insertions, 0 deletions
diff --git a/product/service.infrastructure/threading/SynchronousCommandProcessor.cs b/product/service.infrastructure/threading/SynchronousCommandProcessor.cs
new file mode 100644
index 0000000..87098aa
--- /dev/null
+++ b/product/service.infrastructure/threading/SynchronousCommandProcessor.cs
@@ -0,0 +1,37 @@
+using System;
+using System.Collections.Generic;
+using System.Linq.Expressions;
+using gorilla.commons.utility;
+
+namespace MoMoney.Service.Infrastructure.Threading
+{
+ public class SynchronousCommandProcessor : CommandProcessor
+ {
+ readonly Queue<Command> queued_commands;
+
+ public SynchronousCommandProcessor()
+ {
+ queued_commands = new Queue<Command>();
+ }
+
+ public void add(Expression<Action> action_to_process)
+ {
+ add(new AnonymousCommand(action_to_process));
+ }
+
+ public void add(Command command_to_process)
+ {
+ queued_commands.Enqueue(command_to_process);
+ }
+
+ public void run()
+ {
+ while (queued_commands.Count > 0) queued_commands.Dequeue().run();
+ }
+
+ public void stop()
+ {
+ queued_commands.Clear();
+ }
+ }
+} \ No newline at end of file