From b6706518054efa9440c8b5b43412e95ad0e73f89 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 10 May 2023 10:50:54 +0200 Subject: Add process::current_handle() --- libbutl/process.cxx | 15 +++++++++++++++ libbutl/process.hxx | 3 +++ 2 files changed, 18 insertions(+) (limited to 'libbutl') 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. // -- cgit v1.1