[haiku-commits] Re: haiku: hrev50886 - in src: add-ons/media/media-add-ons/multi_audio kits/media/experimental
- From: Julian Harnath <julian.harnath@xxxxxxxxxxxxxx>
- To: <haiku-commits@xxxxxxxxxxxxx>
- Date: Fri, 20 Jan 2017 21:14:36 +0100
Hey,
On 20.01.2017 21:08, Dario Casalinuovo wrote:
Since the flag you added is not an atomic, this is essentially broken.
Why you want an atomic operation there?
You're writing a variable from one thread, while reading it from
another, without any synchronization or memory barriers. So memory
visibility is undefined. In theory, the write might never become visible
to the other thread at all (although that's unlikely in practice), or it
becomes visible out of the expected order with respect to other accesses
(i.e. total chaos ensues).
See e.g. here
https://en.wikipedia.org/wiki/Memory_barrier#An_illustrative_example
for an example of how it can go wrong.
-Julian
Other related posts: