volatile Questions

25

Solved

At work today, I came across the volatile keyword in Java. Not being very familiar with it, I found this explanation. Given the detail in which that article explains the keyword in question, do you...
Addlepated asked 20/9, 2008 at 0:41

2

Solved

is there an easy way (workaround) how to disable automatic re-calculations of volatile functions like =RAND() =RANDARRAY() =RANDBETWEEN() in google spreadsheet (?) without scripts without addons w...

12

Solved

What does AtomicBoolean do that a volatile boolean cannot achieve?
Professoriate asked 24/9, 2010 at 12:1

1

Lets suppose following: I have two processes on Linux / Mac OS. I have mmap on shared memory (or in a file). Then in both processes I have following: struct Data{ volatile int reload = 0; // using...
Dissemblance asked 24/8, 2022 at 11:32

3

Solved

In C++ we have keyword volatile and atomic class. Difference between them is that volatile does not guarantee thread-safe concurrent reading and writing, but just ensures that compiler will not sto...
Ligan asked 28/10, 2018 at 14:4

1

Solved

So, recently in a job interview for a job as an embedded C developer the interviewer asked me: What is the point of declaring const volatile int *p;? The answer that I gave was that this was the ...
Epilogue asked 18/7, 2022 at 18:39

3

Solved

I have a buffer that I use for UART, which is declared this way: union Eusart_Buff { uint8_t b8[16]; uint16_t b9[16]; }; struct Eusart_Msg { uint8_t msg_posn; uint8_t msg_len; union Eusart_B...
Bucentaur asked 2/3, 2019 at 23:38

2

Solved

What is the difference, if any, of the Read(Int64) method of the .NET system classes System.Threading.Volatile and System.Threading.Interlocked? Specifically, what are their respective guarantees ...
Triangle asked 15/8, 2019 at 9:17

6

We use volatile in one of our projects to maintain the same copy of variable accessed by different threads. My question is whether it is alright to use volatile with static. The compiler does not g...
Christianize asked 3/2, 2011 at 11:31

5

Solved

A question like mine has been asked, but mine is a bit different. The question is, "Why is the volatile keyword not allowed in C# on types System.Double and System.Int64, etc.?" On first blush, I ...
Pericardium asked 18/1, 2011 at 17:27

1

In building libraries for controlling hardware on embedded microprocessors, a common task is manipulating bits at specific memory locations for controlling hardware features. In AVR processors, Atm...
Torsibility asked 2/2, 2019 at 0:33

7

Solved

Consider the following code: int square(volatile int *p) { return *p * *p; } Now, the volatile keyword indicates that the value in a memory location can be altered in ways unknown to the compil...
Hyp asked 22/10, 2015 at 12:18

2

Whilst writing this answer I realised that I'm not as confident about my conclusions as I usually would ensure before hitting Post Your Answer. I can find a couple of reasonably convincing citatio...
Paryavi asked 15/11, 2012 at 22:57

2

Solved

What is the difference between Interlocked.Exchange and Volatile.Write? Both methods update value of some variable. Can someone summarize when to use each of them? Interlocked.Exchange Volatile.Wr...

10

Solved

Let's say that a class has a public int counter field that is accessed by multiple threads. This int is only incremented or decremented. To increment this field, which approach should be used, and...
Nelsonnema asked 30/9, 2008 at 19:25

2

Solved

when a thread reads a volatile variable, it sees not just the latest change to the volatile, but also the side effects of the code that led up the change This is mentioned at http://docs.oracle...
Anschauung asked 2/11, 2013 at 3:24

2

Solved

The documentation on volatile says: When the /volatile:ms compiler option is used—by default when architectures other than ARM are targeted—the compiler generates extra code to maintain ordering...
Iminourea asked 5/6, 2017 at 17:40

2

Solved

Recently, I discussed why there is a volatile mark at seq in Java Actors demo @volatile private var seq = 0L private def nextSeq: Long = { val next = seq seq += 1 next } One answer was that t...
Syreetasyria asked 11/6, 2015 at 7:38

3

While writing an answer regarding how compilers must treat volatile, I believe I may have stumbled upon a gcc bug and would like someone to verify before I report it. I wrote up a simple function s...
Maguire asked 16/12, 2021 at 14:16

2

Solved

I seem to have a reasonable understanding of volatiles in general, but there's one seemingly obscure case, in which I'm not sure how things are supposed to work per the standard. I've read the rele...
Jackfruit asked 1/10, 2012 at 2:35

5

Solved

Here: An object is considered to be completely initialized when its constructor finishes. A thread that can only see a reference to an object after that object has been completely initialized is g...
Ewing asked 19/10, 2021 at 22:25

2

Solved

Under what circumstances should you use the volatile keyword with a CUDA kernel's shared memory? I understand that volatile tells the compiler never to cache any values, but my question is about th...
Marthena asked 11/3, 2013 at 4:2

5

Solved

I'm reading about the Java volatile keyword and have confusion about its 'visibility'. A typical usage of volatile keyword is: volatile boolean ready = false; int value = 0; void publisher() { va...
Carranza asked 18/7, 2021 at 8:42

1

Solved

In the book "Is Parallel Programming Hard, And, If So,What Can You Do About It?", the author uses several macros that I don't understand what they actually do. #define ACCESS_ONCE(x) (*(v...
Algo asked 5/9, 2021 at 20:0

3

Solved

How does one mark a var in Kotlin volatile? volatile public var tmpEndedAt: Long? = null gives me the error: "unresolved reference: volatile"
Cassy asked 8/6, 2015 at 14:58

© 2022 - 2024 — McMap. All rights reserved.