mirror of
https://gitlab.com/qemu-project/qemu
synced 2024-09-06 18:05:37 +00:00
tests/channel-helper: set blocking in main thread
The /io/channel/command/echo tests run the reader side and the writer side with the same underlying command channel. Setting the blocking mode of the fd/handles while the other end is already reading/writing may create issues (deadlock in win32 when earlier attempt of this series were using SetNamedPipeHandleState). Let's just do it before spawning the threads to avoid further concurrency issues. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Message-Id: <20221006113657.2656108-4-marcandre.lureau@redhat.com>
This commit is contained in:
parent
3f08376c2e
commit
bb06b0143b
|
@ -25,7 +25,6 @@
|
||||||
struct QIOChannelTest {
|
struct QIOChannelTest {
|
||||||
QIOChannel *src;
|
QIOChannel *src;
|
||||||
QIOChannel *dst;
|
QIOChannel *dst;
|
||||||
bool blocking;
|
|
||||||
size_t len;
|
size_t len;
|
||||||
size_t niov;
|
size_t niov;
|
||||||
char *input;
|
char *input;
|
||||||
|
@ -42,8 +41,6 @@ static gpointer test_io_thread_writer(gpointer opaque)
|
||||||
{
|
{
|
||||||
QIOChannelTest *data = opaque;
|
QIOChannelTest *data = opaque;
|
||||||
|
|
||||||
qio_channel_set_blocking(data->src, data->blocking, NULL);
|
|
||||||
|
|
||||||
qio_channel_writev_all(data->src,
|
qio_channel_writev_all(data->src,
|
||||||
data->inputv,
|
data->inputv,
|
||||||
data->niov,
|
data->niov,
|
||||||
|
@ -58,8 +55,6 @@ static gpointer test_io_thread_reader(gpointer opaque)
|
||||||
{
|
{
|
||||||
QIOChannelTest *data = opaque;
|
QIOChannelTest *data = opaque;
|
||||||
|
|
||||||
qio_channel_set_blocking(data->dst, data->blocking, NULL);
|
|
||||||
|
|
||||||
qio_channel_readv_all(data->dst,
|
qio_channel_readv_all(data->dst,
|
||||||
data->outputv,
|
data->outputv,
|
||||||
data->niov,
|
data->niov,
|
||||||
|
@ -113,7 +108,9 @@ void qio_channel_test_run_threads(QIOChannelTest *test,
|
||||||
|
|
||||||
test->src = src;
|
test->src = src;
|
||||||
test->dst = dst;
|
test->dst = dst;
|
||||||
test->blocking = blocking;
|
|
||||||
|
qio_channel_set_blocking(test->dst, blocking, NULL);
|
||||||
|
qio_channel_set_blocking(test->src, blocking, NULL);
|
||||||
|
|
||||||
reader = g_thread_new("reader",
|
reader = g_thread_new("reader",
|
||||||
test_io_thread_reader,
|
test_io_thread_reader,
|
||||||
|
|
Loading…
Reference in a new issue