[LyX/master] Change os::timeout from minutes to milliseconds

Scott Kostyshak skostysh at lyx.org
Fri Nov 25 14:40:42 UTC 2022


commit 68c7953422f5f1e05fdc2efd913857836d951fe0
Author: Scott Kostyshak <skostysh at lyx.org>
Date:   Fri Nov 25 09:51:30 2022 -0500

    Change os::timeout from minutes to milliseconds
    
    We can now specify the special value of "-1" milliseconds which is
    interpreted as disabling the timeout.
    
    No change of functionality intended.
---
 src/support/Systemcall.cpp |    2 +-
 src/support/os.cpp         |    6 ++++--
 src/support/os.h           |    4 ++--
 3 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/support/Systemcall.cpp b/src/support/Systemcall.cpp
index 20fe103..7c4eaab 100644
--- a/src/support/Systemcall.cpp
+++ b/src/support/Systemcall.cpp
@@ -290,7 +290,7 @@ int Systemcall::startscript(Starttype how, string const & what,
 	}
 
 	if (!d.waitWhile(SystemcallPrivate::Running, do_events,
-			 os::timeout_min() * 60 * 1000)) {
+			 os::timeout_ms())) {
 		if (d.state == SystemcallPrivate::Killed) {
 			LYXERR0("Killed: " << cmd);
 			return KILLED;
diff --git a/src/support/os.cpp b/src/support/os.cpp
index 407e1de..8fd6492 100644
--- a/src/support/os.cpp
+++ b/src/support/os.cpp
@@ -45,9 +45,11 @@ namespace lyx {
 namespace support {
 namespace os {
 
-int timeout_min()
+int timeout_ms()
 {
-	return 3;
+	// return -1 to disable the timeout completely.
+	// (-1 is a special case in SystemcallPrivate::waitWhile()).
+	return 3 * 60 * 1000;
 }
 
 
diff --git a/src/support/os.h b/src/support/os.h
index 07d6d7b..d89af7d 100644
--- a/src/support/os.h
+++ b/src/support/os.h
@@ -55,8 +55,8 @@ std::string current_root();
 ///
 shell_type shell();
 
-/// Returns no. of minutes allowed for a command to complete.
-int timeout_min();
+/// Returns no. of milliseconds allowed for a command to complete.
+int timeout_ms();
 
 /// Name of the python interpreter
 /// @param reset True if the python path should be recomputed


More information about the lyx-cvs mailing list