scm: implement blocking / non-blocking modes

Implement running the REPL on background thread. That way, we can _share_ the
store&.
This commit is contained in:
Dirk-Jan C. Binnema
2025-08-23 09:13:40 +03:00
parent 81ff303d2e
commit d5a0fce4cf
5 changed files with 177 additions and 113 deletions

View File

@ -39,28 +39,24 @@
*
*/
namespace Mu::Scm {
/**
* Configuration object
* Start a guile REPL or program
*
*/
struct Config {
const Mu::Store& store;
const Options& options;
};
/**
* Start a guile shell
*
* Initialize the Scm sub-system, then start a shell or run a script,
* Initialize the Scm sub-system, then start a REPL or run a script,
* based on the configuration.
*
* @param conf a Config object
* Unless 'blocking' is false or there is some pre-guile error, this
* method never returns. If blocking is false, it runs in the
* background.
*
* @param store a Store object
* @param opts options
* @param blocking whether to block (or run in the background)
*
* @return Ok() or some error
*/
Result<void> run(const Config& conf);
Result<void> run(const Store& store, const Options& opts,
bool blocking=true);
/**
* Helpers