diff options
author | Takamichi Horikawa <takamichiho@gmail.com> | 2017-03-14 19:10:24 +0900 |
---|---|---|
committer | Takamichi Horikawa <takamichiho@gmail.com> | 2017-03-14 19:10:24 +0900 |
commit | 46e2455027537dc1ef56b98b712cf92edf27dca5 (patch) | |
tree | e2a09f9b53274a22c0f9a08a2a56bf3f31cf507e /gtk/toneview.c | |
parent | 16be4100808e09a94e802adb58bc1c79e5eefd65 (diff) |
add initial PMD support
Diffstat (limited to 'gtk/toneview.c')
-rw-r--r-- | gtk/toneview.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/gtk/toneview.c b/gtk/toneview.c index 79be94f..47c8f86 100644 --- a/gtk/toneview.c +++ b/gtk/toneview.c @@ -3,7 +3,9 @@ #include <stdatomic.h> #include <stdbool.h> -struct toneview_g toneview_g; +struct toneview_g toneview_g = { + .flag = ATOMIC_FLAG_INIT +}; static struct { GtkWidget *tonewin; @@ -14,7 +16,9 @@ static struct { enum fmplayer_tonedata_format format; bool normalize; GtkClipboard *clipboard; -} g; +} g = { + .normalize = true +}; static void on_destroy(GtkWidget *w, gpointer ptr) { (void)w; @@ -26,11 +30,10 @@ gboolean tick_cb(GtkWidget *widget, GdkFrameClock *clock, gpointer ptr) { (void)widget; (void)clock; (void)ptr; - bool xchg = false; - if (atomic_compare_exchange_weak_explicit(&toneview_g.flag, &xchg, true, - memory_order_acquire, memory_order_relaxed)) { + if (!atomic_flag_test_and_set_explicit( + &toneview_g.flag, memory_order_acquire)) { g.tonedata = toneview_g.tonedata; - atomic_store_explicit(&toneview_g.flag, false, memory_order_release); + atomic_flag_clear_explicit(&toneview_g.flag, memory_order_release); } g.tonedata_n = g.tonedata; for (int c = 0; c < 6; c++) { |