summaryrefslogtreecommitdiff
path: root/lib/infrastructure/threading/SynchronousCommandProcessor.cs
diff options
context:
space:
mode:
authormo khan <mo.khan@gmail.com>2019-10-20 16:30:37 -0600
committermo khan <mo.khan@gmail.com>2019-10-20 16:30:37 -0600
commitddbc87ff5fa56513cf836838b06b08156408ebcf (patch)
tree96f7d3f7f9a857d1f532baf001d5c294f0dffecc /lib/infrastructure/threading/SynchronousCommandProcessor.cs
parentd9819d134b27a14235a50bd89d3433e6198730c9 (diff)
dump legacy items
Diffstat (limited to 'lib/infrastructure/threading/SynchronousCommandProcessor.cs')
-rwxr-xr-xlib/infrastructure/threading/SynchronousCommandProcessor.cs36
1 files changed, 36 insertions, 0 deletions
diff --git a/lib/infrastructure/threading/SynchronousCommandProcessor.cs b/lib/infrastructure/threading/SynchronousCommandProcessor.cs
new file mode 100755
index 0000000..051fedd
--- /dev/null
+++ b/lib/infrastructure/threading/SynchronousCommandProcessor.cs
@@ -0,0 +1,36 @@
+using System;
+using System.Collections.Generic;
+using gorilla.utility;
+
+namespace gorilla.infrastructure.threading
+{
+ public class SynchronousCommandProcessor : CommandProcessor
+ {
+ readonly Queue<Command> queued_commands;
+
+ public SynchronousCommandProcessor()
+ {
+ queued_commands = new Queue<Command>();
+ }
+
+ public void add(Action command)
+ {
+ add(new AnonymousCommand(command));
+ }
+
+ 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