rt prio warning: fix race condition

This commit is contained in:
Andrew Kelley 2015-07-20 16:52:07 -07:00
parent 20f3f76ef3
commit 1e7cd145ad
2 changed files with 12 additions and 12 deletions

View file

@ -185,14 +185,13 @@ static void *run_pthread(void *userdata) {
return NULL;
}
static void emit_rtprio_warning(void) {
static bool seen = false;
if (seen)
return;
seen = true;
static atomic_flag seen = ATOMIC_FLAG_INIT;
if (!seen.test_and_set()) {
fprintf(stderr, "warning: unable to set high priority thread: Operation not permitted\n");
fprintf(stderr, "See https://github.com/andrewrk/genesis/wiki/"
"warning:-unable-to-set-high-priority-thread:-Operation-not-permitted\n");
}
}
#endif
int soundio_os_thread_create(

View file

@ -509,11 +509,12 @@ int soundio_outstream_fill_with_silence(struct SoundIoOutStream *outstream);
int soundio_outstream_free_count(struct SoundIoOutStream *outstream);
// Call this function when you are ready to begin writing to the device buffer.
// `outstream` - (in) The output stream you want to write to.
// `areas` - (out) The memory addresses you can write data to.
// `frame_count` - (in/out) Provide the number of frames you want to write.
// returned will be the number of frames you actually can write. If this number
// is greater than zero, you must call this function again.
// * `outstream` - (in) The output stream you want to write to.
// * `areas` - (out) The memory addresses you can write data to. It is OK to
// modify the pointers if that helps you iterate.
// * `frame_count` - (in/out) Provide the number of frames you want to write.
// Returned will be the number of frames you actually can write. If this
// number is greater than zero, you must call this function again.
int soundio_outstream_begin_write(struct SoundIoOutStream *outstream,
struct SoundIoChannelArea **areas, int *frame_count);