All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: marcandre.lureau@redhat.com
Cc: qemu-devel@nongnu.org
Subject: Re: [PATCH v3 2/5] tests/channel-helper: set blocking in main thread
Date: Thu, 6 Oct 2022 09:25:27 +0100	[thread overview]
Message-ID: <Yz6Q90gX45EZ50Ip@redhat.com> (raw)
In-Reply-To: <20221006081222.2606746-3-marcandre.lureau@redhat.com>

On Thu, Oct 06, 2022 at 12:12:19PM +0400, marcandre.lureau@redhat.com wrote:
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
> 
> 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.

Curious, makes me wonder why I did this in the threads in the first
place...

> 
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>  tests/unit/io-channel-helpers.c | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


> 
> diff --git a/tests/unit/io-channel-helpers.c b/tests/unit/io-channel-helpers.c
> index ff156ed3c4..c0799c21c2 100644
> --- a/tests/unit/io-channel-helpers.c
> +++ b/tests/unit/io-channel-helpers.c
> @@ -25,7 +25,6 @@
>  struct QIOChannelTest {
>      QIOChannel *src;
>      QIOChannel *dst;
> -    bool blocking;
>      size_t len;
>      size_t niov;
>      char *input;
> @@ -42,8 +41,6 @@ static gpointer test_io_thread_writer(gpointer opaque)
>  {
>      QIOChannelTest *data = opaque;
>  
> -    qio_channel_set_blocking(data->src, data->blocking, NULL);
> -
>      qio_channel_writev_all(data->src,
>                             data->inputv,
>                             data->niov,
> @@ -58,8 +55,6 @@ static gpointer test_io_thread_reader(gpointer opaque)
>  {
>      QIOChannelTest *data = opaque;
>  
> -    qio_channel_set_blocking(data->dst, data->blocking, NULL);
> -
>      qio_channel_readv_all(data->dst,
>                            data->outputv,
>                            data->niov,
> @@ -113,7 +108,9 @@ void qio_channel_test_run_threads(QIOChannelTest *test,
>  
>      test->src = src;
>      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",
>                            test_io_thread_reader,
> -- 
> 2.37.3
> 

With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|



  reply	other threads:[~2022-10-06  8:59 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-06  8:12 [PATCH v3 0/5] io/command: implement portable spawn marcandre.lureau
2022-10-06  8:12 ` [PATCH v3 1/5] osdep: make readv_writev() work with partial read/write marcandre.lureau
2022-10-06  8:31   ` Daniel P. Berrangé
2022-10-06  8:12 ` [PATCH v3 2/5] tests/channel-helper: set blocking in main thread marcandre.lureau
2022-10-06  8:25   ` Daniel P. Berrangé [this message]
2022-10-06  8:12 ` [PATCH v3 3/5] io/command: use glib GSpawn, instead of open-coding fork/exec marcandre.lureau
2022-10-06  8:12 ` [PATCH v3 4/5] io/command: implement support for win32 marcandre.lureau
2022-10-06  8:38   ` Daniel P. Berrangé
2022-10-06  8:12 ` [PATCH v3 5/5] tests/unit: make test-io-channel-command work on win32 marcandre.lureau
2022-10-06  8:42   ` Daniel P. Berrangé
2022-10-06  8:46     ` Marc-André Lureau
2022-10-06  8:56       ` Daniel P. Berrangé
2022-10-06 11:26         ` Marc-André Lureau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Yz6Q90gX45EZ50Ip@redhat.com \
    --to=berrange@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.