Application is identified by one of its threads.

Signed-off-by: Justin Cinkelj <justin.cink...@xlab.si>
---
 core/app.cc        | 8 ++++++++
 include/osv/app.hh | 5 +++++
 2 files changed, 13 insertions(+)

diff --git a/core/app.cc b/core/app.cc
index 7fa76a7..ea00661 100644
--- a/core/app.cc
+++ b/core/app.cc
@@ -456,6 +456,14 @@ void application::merge_in_environ(bool new_program,
     }
 }
 
+void with_all_app_threads(std::function<void(sched::thread &)> f, 
sched::thread& th1) {
+    sched::with_all_threads([&](sched::thread &th2) {
+        if (th2.app_runtime() == th1.app_runtime()) {
+            f(th2);
+        }
+    });
+}
+
 namespace this_application {
 
 void on_termination_request(std::function<void()> callback)
diff --git a/include/osv/app.hh b/include/osv/app.hh
index 43612e6..4fe261b 100644
--- a/include/osv/app.hh
+++ b/include/osv/app.hh
@@ -200,6 +200,11 @@ private:
     friend struct application_runtime;
 };
 
+/*
+Execute f on all threads which belong to same app as t1 does.
+*/
+void with_all_app_threads(std::function<void(sched::thread &)> f, 
sched::thread& th1);
+
 }
 
 #endif /* _KERNEL */
-- 
2.5.0

-- 
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to osv-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to