From b808c255b6a9ddba085bf5646e7d20ec344f2e2d Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 28 Apr 2020 08:48:53 +0200 Subject: Initial support for ad hoc recipes (still work in progress) --- libbuild2/context.hxx | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'libbuild2/context.hxx') diff --git a/libbuild2/context.hxx b/libbuild2/context.hxx index 573b8d1..2a9c93e 100644 --- a/libbuild2/context.hxx +++ b/libbuild2/context.hxx @@ -428,7 +428,7 @@ namespace build2 // const loaded_modules_lock* modules_lock; - // Nested context for updating build system modules. + // Nested context for updating build system modules and ad hoc recipes. // // Note that such a context itself should normally have modules_context // setup to point to itself (see import_module() for details). @@ -438,9 +438,10 @@ namespace build2 public: // If module_context is absent, then automatic updating of build system - // modules is disabled. If it is NULL, then the context will be created - // lazily if and when necessary. Otherwise, it should be a properly setup - // context (including, normally, a self-reference in modules_context). + // modules and ad hoc recipes is disabled. If it is NULL, then the context + // will be created lazily if and when necessary. Otherwise, it should be a + // properly setup context (including, normally, a self-reference in + // modules_context). // explicit context (scheduler&, @@ -553,9 +554,17 @@ namespace build2 // Assuming we have a lock on the current phase, temporarily switch to a // new phase and switch back on destruction. // + // The second constructor can be used for a switch with an intermittent + // unlock: + // + // phase_unlock pu; + // phase_lock pl; + // phase_switch ps (move (pu), move (pl)); + // struct LIBBUILD2_SYMEXPORT phase_switch { - explicit phase_switch (context&, run_phase); + phase_switch (context&, run_phase); + phase_switch (phase_unlock&&, phase_lock&&); ~phase_switch () noexcept (false); run_phase old_phase, new_phase; -- cgit v1.1