diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2025-02-13 14:05:25 +0200 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2025-02-13 14:05:25 +0200 |
commit | b4eb01f725d60734cbe069aa8bfcd32779845cdc (patch) | |
tree | b04e1c8cb396ecc39e964c3cf934efa39bbd2a3e | |
parent | 84c13fe970101b6f0b1c0510f80c445f2ab9540a (diff) |
-rw-r--r-- | libbuild2/build/script/script.cxx | 6 | ||||
-rw-r--r-- | libbuild2/build/script/script.hxx | 5 | ||||
-rw-r--r-- | libbuild2/script/run.cxx | 2 | ||||
-rw-r--r-- | libbuild2/script/script.hxx | 5 | ||||
-rw-r--r-- | libbuild2/test/script/script.cxx | 6 | ||||
-rw-r--r-- | libbuild2/test/script/script.hxx | 5 |
6 files changed, 28 insertions, 1 deletions
diff --git a/libbuild2/build/script/script.cxx b/libbuild2/build/script/script.cxx index 0d96cc3..fba38a8 100644 --- a/libbuild2/build/script/script.cxx +++ b/libbuild2/build/script/script.cxx @@ -235,6 +235,12 @@ namespace build2 } } + void environment:: + sleep (const duration& d) + { + context.sched->sleep (d); + } + lookup environment:: lookup (const variable& var) const { diff --git a/libbuild2/build/script/script.hxx b/libbuild2/build/script/script.hxx index 08f1bf4..19f6d0b 100644 --- a/libbuild2/build/script/script.hxx +++ b/libbuild2/build/script/script.hxx @@ -189,6 +189,11 @@ namespace build2 virtual void create_temp_dir () override; + // Call the scheduler's sleep() function. + // + virtual void + sleep (const duration&) override; + // Variables. // public: diff --git a/libbuild2/script/run.cxx b/libbuild2/script/run.cxx index 528f42f..e669b29 100644 --- a/libbuild2/script/run.cxx +++ b/libbuild2/script/run.cxx @@ -3083,7 +3083,7 @@ namespace build2 // If/when required we could probably support the precise sleep // mode (e.g., via an option). // - env.context.sched->sleep (t); + env.sleep (t); } }; diff --git a/libbuild2/script/script.hxx b/libbuild2/script/script.hxx index f5bd69a..76c4010 100644 --- a/libbuild2/script/script.hxx +++ b/libbuild2/script/script.hxx @@ -588,6 +588,11 @@ namespace build2 virtual void create_temp_dir () = 0; + // Used as an implementation of the sleep builtin. + // + virtual void + sleep (const duration&) = 0; + public: virtual ~environment () = default; diff --git a/libbuild2/test/script/script.cxx b/libbuild2/test/script/script.cxx index 7862120..176daf3 100644 --- a/libbuild2/test/script/script.cxx +++ b/libbuild2/test/script/script.cxx @@ -181,6 +181,12 @@ namespace build2 : exported_vars; } + void scope:: + sleep (const duration& d) + { + context.sched->sleep (d); + } + // script_base // script_base:: diff --git a/libbuild2/test/script/script.hxx b/libbuild2/test/script/script.hxx index 9409b01..d1e0f53 100644 --- a/libbuild2/test/script/script.hxx +++ b/libbuild2/test/script/script.hxx @@ -140,6 +140,11 @@ namespace build2 virtual void create_temp_dir () override {assert (false);}; + // Call the scheduler's sleep() function. + // + virtual void + sleep (const duration&) override; + // Return true if this is a test program path. // // Note that currently the test program is only specified via the test |