Mark select channel as dirty on mux_init()

Ensures that the select callback will be called on the propagation
phase, immediately setting the right output. Otherwise the mux won't be
updated until the select channel sets a new value.
This commit is contained in:
Rodrigo Arias 2023-02-20 11:48:23 +01:00 committed by Rodrigo Arias Mallo
parent 2b84318ebe
commit b265442b8c
3 changed files with 36 additions and 0 deletions

View File

@ -192,6 +192,13 @@ mux_init(struct mux *mux,
return -1;
}
/* Mark the select channel as dirty, so it runs the select
* callback even if it doesn't have a new value */
if (chan_dirty(select) != 0) {
err("chan_dirty failed");
return -1;
}
return 0;
}

View File

@ -8,3 +8,4 @@ ovni_test(task-types.c MP)
ovni_test(blocking.c MP)
ovni_test(ss-mismatch.c SHOULD_FAIL
REGEX "thread [0-9]\\+ ended with 1 stacked nanos6 subsystems")
ovni_test(delayed-connect-ss.c)

View File

@ -0,0 +1,28 @@
/* Copyright (c) 2023 Barcelona Supercomputing Center (BSC)
* SPDX-License-Identifier: GPL-3.0-or-later */
#include "instr_nanos6.h"
int
main(void)
{
instr_start(0, 1);
/* Until here, the nanos6 model has not been connected to the
* patchbay yet. The next event will cause the subsystem mux to
* be connected to the patchbay. We need to ensure that at that
* moment the select channel is evaluated, otherwise the mux
* will remain selecting a null input until the thread state
* changes. */
/* FIXME: We should be able to test that after emitting the
* nanos6 event the emulator follows some properties. */
instr_nanos6_worker_loop_enter();
instr_nanos6_worker_loop_exit();
instr_end();
return 0;
}