aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2025-09-05 14:34:57 +0200
committerStefan Boberg <[email protected]>2025-09-05 14:34:57 +0200
commit5838e0fa6e7335d2895105f86611b0d4ba11b4f9 (patch)
treedf02e6d1a11912c01804e680c307ffd0f7e9ad20 /src
parenttest code (diff)
downloadzen-5838e0fa6e7335d2895105f86611b0d4ba11b4f9.tar.xz
zen-5838e0fa6e7335d2895105f86611b0d4ba11b4f9.zip
ad hoc flow control
Diffstat (limited to 'src')
-rw-r--r--src/zenmaster/zenmaster.cpp28
1 files changed, 26 insertions, 2 deletions
diff --git a/src/zenmaster/zenmaster.cpp b/src/zenmaster/zenmaster.cpp
index 4981a3eb0..c9576e4a4 100644
--- a/src/zenmaster/zenmaster.cpp
+++ b/src/zenmaster/zenmaster.cpp
@@ -44,7 +44,30 @@ ZEN_THIRD_PARTY_INCLUDES_END
#if ZEN_PLATFORM_LINUX || ZEN_PLATFORM_MAC
# include <sys/ioctl.h>
# include <unistd.h>
-#endif
+# include <termios.h>
+
+char getch(void)
+{
+ char buf = 0;
+ struct termios old = {0};
+ fflush(stdout);
+ if(tcgetattr(0, &old) < 0)
+ perror("tcsetattr()");
+ old.c_lflag &= ~ICANON;
+ old.c_lflag &= ~ECHO;
+ old.c_cc[VMIN] = 1;
+ old.c_cc[VTIME] = 0;
+ if(tcsetattr(0, TCSANOW, &old) < 0)
+ perror("tcsetattr ICANON");
+ if(read(0, &buf, 1) < 0)
+ perror("read()");
+ old.c_lflag |= ICANON;
+ old.c_lflag |= ECHO;
+ if(tcsetattr(0, TCSADRAIN, &old) < 0)
+ perror("tcsetattr ~ICANON");
+ return buf;
+ }
+ #endif
//////////////////////////////////////////////////////////////////////////
@@ -338,7 +361,8 @@ main(int argc, char** argv)
}
});
- zen::Sleep(10000);
+ ZEN_INFO("press any key to tear instances down");
+ ::getch();
TimedBlock("Shutting down instances", [&] {
for (int i = 0; i < SpawnCount; ++i)