Browse Source

use c11 threads conditionally

translate
Alexandros Theodotou 2 months ago
parent
commit
f0527aa333
Signed by: alex
GPG Key ID: 022EAE42313D70F3
  1. 1
      meson.build
  2. 8
      src/audio/router.c

1
meson.build

@ -400,6 +400,7 @@ if os_gnu @@ -400,6 +400,7 @@ if os_gnu
if have_unlimited_mem
cdata.set ('HAVE_UNLIMITED_MEM', 1)
endif
cdata.set ('HAVE_C11_THREADS', 1)
endif
# --- Check for size of data types ---

8
src/audio/router.c

@ -33,7 +33,10 @@ @@ -33,7 +33,10 @@
#include "audio/engine.h"
#include "audio/engine_alsa.h"
#ifdef HAVE_C11_THREADS
#include <threads.h>
#endif
#ifdef HAVE_JACK
# include "audio/engine_jack.h"
#endif
@ -271,9 +274,14 @@ router_is_processing_kickoff_thread (const Router * const self) @@ -271,9 +274,14 @@ router_is_processing_kickoff_thread (const Router * const self)
bool
router_is_processing_thread (const Router * const self)
{
#ifdef HAVE_C11_THREADS
/* this is called too often so use this optimization */
static thread_local bool have_result = false;
static thread_local bool is_processing_thread = false;
#else
bool have_result = false;
bool is_processing_thread = false;
#endif
if (G_LIKELY (have_result))
{

Loading…
Cancel
Save