avoid using g_atomic* directly

This commit is contained in:
derselbst 2017-10-28 12:57:47 +02:00
parent ad9c185dca
commit f2263e2f62

View file

@ -107,7 +107,7 @@ typedef struct {
struct pollfd *pfd;
int npfd;
fluid_thread_t *thread;
gint should_quit;
fluid_atomic_int_t should_quit;
unsigned char buffer[BUFFER_LENGTH];
fluid_midi_parser_t* parser;
} fluid_alsa_rawmidi_driver_t;
@ -131,7 +131,7 @@ typedef struct {
struct pollfd *pfd;
int npfd;
fluid_thread_t *thread;
gint should_quit;
fluid_atomic_int_t should_quit;
int port_count;
} fluid_alsa_seq_driver_t;
@ -627,7 +627,7 @@ new_fluid_alsa_rawmidi_driver(fluid_settings_t* settings,
}
FLUID_FREE(pfd);
g_atomic_int_set(&dev->should_quit, 0);
fluid_atomic_int_set(&dev->should_quit, 0);
/* create the MIDI thread */
dev->thread = new_fluid_thread ("alsa-midi-raw", fluid_alsa_midi_run, dev, realtime_prio, FALSE);
@ -660,7 +660,7 @@ delete_fluid_alsa_rawmidi_driver(fluid_midi_driver_t* p)
}
/* cancel the thread and wait for it before cleaning up */
g_atomic_int_set(&dev->should_quit, 1);
fluid_atomic_int_set(&dev->should_quit, 1);
if (dev->thread)
fluid_thread_join (dev->thread);
@ -686,7 +686,7 @@ fluid_alsa_midi_run(void* d)
int n, i;
/* go into a loop until someone tells us to stop */
while (!g_atomic_int_get(&dev->should_quit)) {
while (!fluid_atomic_int_get(&dev->should_quit)) {
/* is there something to read? */
n = poll(dev->pfd, dev->npfd, 100); /* use a 100 milliseconds timeout */
@ -698,7 +698,7 @@ fluid_alsa_midi_run(void* d)
n = snd_rawmidi_read(dev->rawmidi_in, dev->buffer, BUFFER_LENGTH);
if ((n < 0) && (n != -EAGAIN)) {
FLUID_LOG(FLUID_ERR, "Failed to read the midi input");
g_atomic_int_set(&dev->should_quit, 1);
fluid_atomic_int_set(&dev->should_quit, 1);
}
/* let the parser convert the data into events */
@ -954,7 +954,7 @@ new_fluid_alsa_seq_driver(fluid_settings_t* settings,
}
#endif /* LASH_ENABLED */
g_atomic_int_set(&dev->should_quit, 0);
fluid_atomic_int_set(&dev->should_quit, 0);
/* create the MIDI thread */
dev->thread = new_fluid_thread ("alsa-midi-seq", fluid_alsa_seq_run, dev, realtime_prio, FALSE);
@ -990,7 +990,7 @@ delete_fluid_alsa_seq_driver(fluid_midi_driver_t* p)
}
/* cancel the thread and wait for it before cleaning up */
g_atomic_int_set(&dev->should_quit, 1);
fluid_atomic_int_set(&dev->should_quit, 1);
if (dev->thread)
fluid_thread_join (dev->thread);
@ -1017,7 +1017,7 @@ fluid_alsa_seq_run(void* d)
fluid_alsa_seq_driver_t* dev = (fluid_alsa_seq_driver_t*) d;
/* go into a loop until someone tells us to stop */
while (!g_atomic_int_get(&dev->should_quit)) {
while (!fluid_atomic_int_get(&dev->should_quit)) {
/* is there something to read? */
n = poll(dev->pfd, dev->npfd, 100); /* use a 100 milliseconds timeout */
@ -1037,7 +1037,7 @@ fluid_alsa_seq_run(void* d)
if (ev != -EPERM && ev != -ENOSPC)
{
FLUID_LOG(FLUID_ERR, "Error while reading ALSA sequencer (code=%d)", ev);
g_atomic_int_set(&dev->should_quit, 1);
fluid_atomic_int_set(&dev->should_quit, 1);
}
break;
}