All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christian Schoenebeck <qemu_oss@crudebyte.com>
To: qemu-devel@nongnu.org
Cc: "Volker Rümelin" <vr_qemu@t-online.de>,
	"Gerd Hoffmann" <kraxel@redhat.com>
Subject: Re: [PATCH 1/3] jackaudio: use ifdefs to hide unavailable functions
Date: Mon, 27 Dec 2021 14:24:19 +0100	[thread overview]
Message-ID: <4841310.u599JrRuOa@silver> (raw)
In-Reply-To: <20211226154017.6067-1-vr_qemu@t-online.de>

On Sonntag, 26. Dezember 2021 16:40:15 CET Volker Rümelin wrote:
> On Windows the jack_set_thread_creator() function and on MacOS the
> pthread_setname_np() function with a thread pointer paramater is
> not available. Use #ifdefs to remove the jack_set_thread_creator()
> function call and the qjack_thread_creator() function in both
> cases.
> 
> The qjack_thread_creator() function just sets the name of the
> created thread for debugging purposes and isn't really necessary.

As far as Windows is concerned, right, there is no jack_set_thread_creator().

I find it actually very useful to have named threads for debugging purposes, 
especially for processes that have a load of threads, but I see there would be 
no easy solution to preserve this for macOS, as on macOS pthread_setname_np() 
must be called from the to be named thread itself, and the thread's entry 
point is on JACK server side, so for now ...

Reviewed-by: Christian Schoenebeck <qemu_oss@crudebyte.com>

> From the jack_set_thread_creator() documentation:
> (...)
> 
> No normal application/client should consider calling this. (...)
> 
> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/785
> Signed-off-by: Volker Rümelin <vr_qemu@t-online.de>
> ---
>  audio/jackaudio.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/audio/jackaudio.c b/audio/jackaudio.c
> index e7de6d5433..317009e936 100644
> --- a/audio/jackaudio.c
> +++ b/audio/jackaudio.c
> @@ -622,6 +622,7 @@ static void qjack_enable_in(HWVoiceIn *hw, bool enable)
>      ji->c.enabled = enable;
>  }
> 
> +#if !defined(WIN32) && defined(CONFIG_PTHREAD_SETNAME_NP_W_TID)
>  static int qjack_thread_creator(jack_native_thread_t *thread,
>      const pthread_attr_t *attr, void *(*function)(void *), void *arg)
>  {
> @@ -635,6 +636,7 @@ static int qjack_thread_creator(jack_native_thread_t
> *thread,
> 
>      return ret;
>  }
> +#endif
> 
>  static void *qjack_init(Audiodev *dev)
>  {
> @@ -687,7 +689,9 @@ static void register_audio_jack(void)
>  {
>      qemu_mutex_init(&qjack_shutdown_lock);
>      audio_driver_register(&jack_driver);
> +#if !defined(WIN32) && defined(CONFIG_PTHREAD_SETNAME_NP_W_TID)
>      jack_set_thread_creator(qjack_thread_creator);
> +#endif
>      jack_set_error_function(qjack_error);
>      jack_set_info_function(qjack_info);
>  }




  reply	other threads:[~2021-12-27 13:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-26 15:38 [PATCH 0/3] misc. audio fixes Volker Rümelin
2021-12-26 15:40 ` [PATCH 1/3] jackaudio: use ifdefs to hide unavailable functions Volker Rümelin
2021-12-27 13:24   ` Christian Schoenebeck [this message]
2021-12-26 15:40 ` [PATCH 2/3] dsoundaudio: fix crackling audio recordings Volker Rümelin
2021-12-26 15:40 ` [PATCH 3/3] hw/audio/intel-hda: fix stream reset Volker Rümelin

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=4841310.u599JrRuOa@silver \
    --to=qemu_oss@crudebyte.com \
    --cc=kraxel@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=vr_qemu@t-online.de \
    /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.