summaryrefslogtreecommitdiffstats
path: root/Source/cmUVProcessChain.cxx
diff options
context:
space:
mode:
authorKyle Edwards <kyle.edwards@kitware.com>2023-06-06 20:31:09 (GMT)
committerKyle Edwards <kyle.edwards@kitware.com>2023-12-05 19:48:24 (GMT)
commit0b043a75b7bb92f071dfac6cc95d32fd01080758 (patch)
tree8dfc7011c98429aaa3416027aa86483608e895b0 /Source/cmUVProcessChain.cxx
parent57b94595a3a0056aef1446ce1827dd945261d362 (diff)
downloadCMake-0b043a75b7bb92f071dfac6cc95d32fd01080758.zip
CMake-0b043a75b7bb92f071dfac6cc95d32fd01080758.tar.gz
CMake-0b043a75b7bb92f071dfac6cc95d32fd01080758.tar.bz2
cmUVProcessChain: Add option for external uv_loop_t
Diffstat (limited to 'Source/cmUVProcessChain.cxx')
-rw-r--r--Source/cmUVProcessChain.cxx29
1 files changed, 27 insertions, 2 deletions
diff --git a/Source/cmUVProcessChain.cxx b/Source/cmUVProcessChain.cxx
index 655e52a..4c72261 100644
--- a/Source/cmUVProcessChain.cxx
+++ b/Source/cmUVProcessChain.cxx
@@ -38,7 +38,8 @@ struct cmUVProcessChain::InternalData
bool Valid = false;
- cm::uv_loop_ptr Loop;
+ cm::uv_loop_ptr BuiltinLoop;
+ uv_loop_t* Loop;
StreamData InputStreamData;
StreamData OutputStreamData;
@@ -74,6 +75,19 @@ cmUVProcessChainBuilder& cmUVProcessChainBuilder::AddCommand(
return *this;
}
+cmUVProcessChainBuilder& cmUVProcessChainBuilder::SetBuiltinLoop()
+{
+ this->Loop = nullptr;
+ return *this;
+}
+
+cmUVProcessChainBuilder& cmUVProcessChainBuilder::SetExternalLoop(
+ uv_loop_t& loop)
+{
+ this->Loop = &loop;
+ return *this;
+}
+
cmUVProcessChainBuilder& cmUVProcessChainBuilder::SetNoStream(Stream stdio)
{
switch (stdio) {
@@ -135,6 +149,11 @@ cmUVProcessChainBuilder& cmUVProcessChainBuilder::SetWorkingDirectory(
return *this;
}
+uv_loop_t* cmUVProcessChainBuilder::GetLoop() const
+{
+ return this->Loop;
+}
+
cmUVProcessChain cmUVProcessChainBuilder::Start() const
{
cmUVProcessChain chain;
@@ -158,6 +177,13 @@ bool cmUVProcessChain::InternalData::Prepare(
{
this->Builder = builder;
+ if (this->Builder->Loop) {
+ this->Loop = this->Builder->Loop;
+ } else {
+ this->BuiltinLoop.init();
+ this->Loop = this->BuiltinLoop;
+ }
+
auto const& input =
this->Builder->Stdio[cmUVProcessChainBuilder::Stream_INPUT];
auto& inputData = this->InputStreamData;
@@ -353,7 +379,6 @@ void cmUVProcessChain::InternalData::Finish()
cmUVProcessChain::cmUVProcessChain()
: Data(cm::make_unique<InternalData>())
{
- this->Data->Loop.init();
}
cmUVProcessChain::cmUVProcessChain(cmUVProcessChain&& other) noexcept