From 1ca8c79f3f003314967e58b90eadbcee27f7e785 Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Sat, 27 May 2023 14:28:05 -0700 Subject: modules/rtv: don't use n_cpus=0 for the context creates This is harmless as long as rtv stays hermetic. But if rtv gets used in a composite scenario in the future by either removing the hermetic flag, or allowing forced overrides, n_cpus=0 will cause the nested module contexts to become threaded on SMP machines. That's problematic if the outer module context is already a threaded render. What's appropriate here is to just propagate the n_cpus down so if an upper layer has already gone threaded, it will be sending down n_cpus=1 to serialize the nested instances. In practice, as-is, this change basically changes nothing, but prepares for a potential future where rtv participates in threaded compositions. Through a lens of "rtv just rejiggers scenes and there settings on a timer from a settings-specified subset of modules and settings" it's arguably useful as just another module. Sometimes you want something to change itself up periodically in say a compose layer. So preparing for this possibility isn't really all that far-fetched/hypothetical. --- src/modules/rtv/rtv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/modules/rtv/rtv.c b/src/modules/rtv/rtv.c index 8648ea3..6255a60 100644 --- a/src/modules/rtv/rtv.c +++ b/src/modules/rtv/rtv.c @@ -195,7 +195,7 @@ static void setup_next_channel(rtv_context_t *ctxt, unsigned ticks) } if (!ctxt->channel->module_ctxt) - (void) til_module_create_context(ctxt->channel->module, ctxt->til_module_context.stream, rand_r(&ctxt->til_module_context.seed), ticks, 0, ctxt->til_module_context.path, ctxt->channel->module_setup, &ctxt->channel->module_ctxt); + (void) til_module_create_context(ctxt->channel->module, ctxt->til_module_context.stream, rand_r(&ctxt->til_module_context.seed), ticks, ctxt->til_module_context.n_cpus, ctxt->til_module_context.path, ctxt->channel->module_setup, &ctxt->channel->module_ctxt); ctxt->channel->last_on_time = now; } @@ -257,7 +257,7 @@ static til_module_context_t * rtv_create_context(const til_module_t *module, til ((rtv_setup_t *)setup)->snow_module_setup = NULL; ctxt->snow_channel.module = til_lookup_module(((rtv_setup_t *)setup)->snow_module_name); - (void) til_module_create_context(ctxt->snow_channel.module, stream, rand_r(&seed), ticks, 0, path, ctxt->snow_channel.module_setup, &ctxt->snow_channel.module_ctxt); + (void) til_module_create_context(ctxt->snow_channel.module, stream, rand_r(&seed), ticks, n_cpus, path, ctxt->snow_channel.module_setup, &ctxt->snow_channel.module_ctxt); } ctxt->log_channels = ((rtv_setup_t *)setup)->log_channels; -- cgit v1.2.1