aboutsummaryrefslogtreecommitdiff
path: root/libbutl
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2023-05-10 10:50:54 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2023-05-10 10:50:54 +0200
commitb6706518054efa9440c8b5b43412e95ad0e73f89 (patch)
treea2c97233ca797d35a2d078ad452989e9d702042e /libbutl
parentb0bf46a7942611729dd8d9d8b8d78cedf26c4685 (diff)
Add process::current_handle()
Diffstat (limited to 'libbutl')
-rw-r--r--libbutl/process.cxx15
-rw-r--r--libbutl/process.hxx3
2 files changed, 18 insertions, 0 deletions
diff --git a/libbutl/process.cxx b/libbutl/process.cxx
index 0bfff03..e416807 100644
--- a/libbutl/process.cxx
+++ b/libbutl/process.cxx
@@ -846,6 +846,12 @@ namespace butl
return getpid ();
}
+ process::handle_type process::
+ current_handle ()
+ {
+ return getpid ();
+ }
+
// process_exit
//
process_exit::
@@ -2078,6 +2084,15 @@ namespace butl
return GetCurrentProcessId ();
}
+ process::handle_type process::
+ current_handle ()
+ {
+ // Note that the returned handle is a pseudo handle (-1) that does not
+ // need to be closed.
+ //
+ return GetCurrentProcess ();
+ }
+
// process_exit
//
process_exit::
diff --git a/libbutl/process.hxx b/libbutl/process.hxx
index 5a6837f..bbb7c89 100644
--- a/libbutl/process.hxx
+++ b/libbutl/process.hxx
@@ -629,6 +629,9 @@ namespace butl
public:
handle_type handle;
+ static handle_type
+ current_handle ();
+
// Absence means that the exit information is not (yet) known. This can be
// because you haven't called wait() yet or because wait() failed.
//