summaryrefslogtreecommitdiff
path: root/src/til.h
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2023-07-28 15:20:58 -0700
committerVito Caputo <vcaputo@pengaru.com>2023-07-28 16:34:18 -0700
commit5221c25be67ee96a747c4e527436c0daa394a44e (patch)
tree88baa2f1310d0fe140e578009b44d012ba71dd91 /src/til.h
parentddb8c7e9ef62a699646745273b0e28324ddde455 (diff)
til: introduce til_module_render_limited() variant
With the introduction of discoverable on-stream contexts, with the intention of modules finding them at runtime for nested rendering, relying exclusively on limiting n_cpus @ til_module_create_context() is no longer adequate. When the nested rendering makes use of a context created elsewhere, it can't make any assumptions about what its n_cpus is, nor should it be attempting to change that value for its use. So this variant just adds a max_cpus parameter for setting an upper bound to whatever is found in the context's n_cpus. The impetus for this is to fix the ref builtin, which you can currently trick into deadlock by performing a nested threaded render within a threaded render. What the ref module should be doing is propagating its own context's n_cpus down as the upper bound, via this new render variant.
Diffstat (limited to 'src/til.h')
-rw-r--r--src/til.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/til.h b/src/til.h
index eea8009..ec078db 100644
--- a/src/til.h
+++ b/src/til.h
@@ -45,6 +45,7 @@ const til_module_t * til_lookup_module(const char *name);
void til_get_modules(const til_module_t ***res_modules, size_t *res_n_modules);
char * til_get_module_names(unsigned flags_excluded, const char **exclusions);
void til_module_render(til_module_context_t *context, til_stream_t *stream, unsigned ticks, til_fb_fragment_t **fragment_ptr);
+void til_module_render_limited(til_module_context_t *context, til_stream_t *stream, unsigned ticks, unsigned max_cpus, til_fb_fragment_t **fragment_ptr);
int til_module_create_contexts(const til_module_t *module, til_stream_t *stream, unsigned seed, unsigned ticks, unsigned n_cpus, til_setup_t *setup, size_t n_contexts, til_module_context_t **res_contexts);
int til_module_create_context(const til_module_t *module, til_stream_t *stream, unsigned seed, unsigned ticks, unsigned n_cpus, til_setup_t *setup, til_module_context_t **res_context);
til_module_context_t * til_module_destroy_context(til_module_context_t *context, til_stream_t *stream);
© All Rights Reserved