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

diff --git a/core/app.cc b/core/app.cc
index cc1324f..2302819 100644
--- a/core/app.cc
+++ b/core/app.cc
@@ -419,6 +419,10 @@ std::string application::get_command()
     return _command;
 }
 
+pid_t application::get_main_thread_id() {
+    return pthread_gettid_np(_thread);
+}
+
 // For simplicity, we will not reuse bits in the bitmap, since no destructor is
 // assigned to the program. In that case, a simple counter would do. But coding
 // this way is easy, and make this future extension simple.
diff --git a/include/osv/app.hh b/include/osv/app.hh
index 03b267e..433e06a 100644
--- a/include/osv/app.hh
+++ b/include/osv/app.hh
@@ -174,6 +174,11 @@ public:
      */
     std::string get_command();
 
+    /**
+      * Returns thread_id/PID of thread running app main() function.
+      */
+    pid_t get_main_thread_id();
+
     std::shared_ptr<application_runtime> runtime() const { return _runtime; }
     std::shared_ptr<elf::object> lib() const { return _lib; }
 
-- 
2.9.3

-- 
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