summaryrefslogtreecommitdiffstats
path: root/src/server/events
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2016-09-18 21:29:30 -0400
committerDavid Robillard <d@drobilla.net>2016-09-29 16:04:19 -0400
commita7f83c70733288ee9efee5c08330fbdf638446db (patch)
tree33c1d507d39a2a642f20498a52eb0c5225cfde43 /src/server/events
parentb40326d759a9b4b2db7eb930f9a32403d4a9227f (diff)
downloadingen-a7f83c70733288ee9efee5c08330fbdf638446db.tar.gz
ingen-a7f83c70733288ee9efee5c08330fbdf638446db.tar.bz2
ingen-a7f83c70733288ee9efee5c08330fbdf638446db.zip
Atomic bundle execution
Diffstat (limited to 'src/server/events')
-rw-r--r--src/server/events/Mark.cpp27
-rw-r--r--src/server/events/Mark.hpp3
2 files changed, 28 insertions, 2 deletions
diff --git a/src/server/events/Mark.cpp b/src/server/events/Mark.cpp
index 32648649..11690487 100644
--- a/src/server/events/Mark.cpp
+++ b/src/server/events/Mark.cpp
@@ -29,6 +29,7 @@ Mark::Mark(Engine& engine,
Type type)
: Event(engine, client, id, timestamp)
, _type(type)
+ , _depth(0)
{}
bool
@@ -40,10 +41,10 @@ Mark::pre_process()
switch (_type) {
case Type::BUNDLE_START:
- stack->start_entry();
+ _depth = stack->start_entry();
break;
case Type::BUNDLE_END:
- stack->finish_entry();
+ _depth = stack->finish_entry();
break;
}
@@ -60,6 +61,28 @@ Mark::post_process()
respond();
}
+Event::Execution
+Mark::get_execution() const
+{
+ if (!_engine.atomic_bundles()) {
+ return Execution::NORMAL;
+ }
+
+ switch (_type) {
+ case Type::BUNDLE_START:
+ if (_depth == 1) {
+ return Execution::BLOCK;
+ }
+ break;
+ case Type::BUNDLE_END:
+ if (_depth == 0) {
+ return Execution::UNBLOCK;
+ }
+ break;
+ }
+ return Execution::NORMAL;
+}
+
} // namespace Events
} // namespace Server
} // namespace Ingen
diff --git a/src/server/events/Mark.hpp b/src/server/events/Mark.hpp
index db5550a0..a68e3b3b 100644
--- a/src/server/events/Mark.hpp
+++ b/src/server/events/Mark.hpp
@@ -48,8 +48,11 @@ public:
void execute(RunContext& context);
void post_process();
+ Execution get_execution() const override;
+
private:
Type _type;
+ int _depth;
};
} // namespace Events