# Naive question about Juce thread safety

**URL:** <https://forum.juce.com/t/naive-question-about-juce-thread-safety/23736>\
**Category:** General JUCE discussion\
**Created:** [August 14, 2017, 7:58pm UTC](https://forum.juce.com/t/naive-question-about-juce-thread-safety/23736 "2017-08-14T19:58:31Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![cool-mr-croc](https://avatars.discourse-cdn.com/v4/letter/c/958977/32.png) [@cool-mr-croc](https://forum.juce.com/u/cool-mr-croc)\
**Post date:** [August 14, 2017, 8:34pm UTC](https://forum.juce.com/t/naive-question-about-juce-thread-safety/23736/2 "2017-08-14T20:34:41Z")

</div>

i’ve seen a good post here

> [@AudioParameter thread safety](https://forum.juce.com/t/audioparameter-thread-safety/21097):
>
> I am looking at the AudioParameterFloat and AudioParameterInt classes in JUCE and I fail to see how they are thread safe. It appears that setValue sets the value and the audio thread gets the value without any sort of fifo or thread safety despite in their base class AudioProcessorParameter it says that getValue and setValue should be “thread aware”. Is it safe to use these classes and set them on the UI thread and get them on the Processing thread as is done in the AudioPlugin Examples?

"The reason they’re done the way they are in the samples is to make the code more readable for beginners. From what I understand it’s technically alright for intel platforms because 32-bit reads/writes are always atomic, so in almost all cases it’s “safe enough” for example code.

How you decide to make them satisfiably thread safe is up to you - there has been debate recently on the best way to achieve inter-thread communication of parameters including double buffering with an intermediate audio processing thread, wrapping parameters in lock-free atomics, or just ignoring the issue for Intel platforms. Someone else with more plugin experience can probably give a better/more definitive answer for real-world practices."

Which answers my question enough for me.

---

_[View the full topic](https://forum.juce.com/t/naive-question-about-juce-thread-safety/23736)._
