python (65.1k questions)
javascript (44.2k questions)
reactjs (22.7k questions)
java (20.8k questions)
c# (17.4k questions)
html (16.3k questions)
r (13.7k questions)
android (12.9k questions)
Could reading & writing int which is declared with volatile and stored on a aligned address be garanteed to be atomic?
Here the related code snippet:
#include <functional>
#include <thread>
#include <iostream>
#include <chrono>
#include <atomic>
#ifdef NO_STUCK_WITH_OPTIMIZATION
using T...
John
Votes: 0
Answers: 0
Why the code snippet gets stuck when optimization is enabled?
There are three question about the code snippet below.
When the macro(i.e. NO_STUCK_WITH_OPTIMIZATION ) is not enabled, why this code snippet gets stuck when the optimization is enabled(i.e. -O1, -O2...
John
Votes: 0
Answers: 1
Data race about map::operator[]
Is there any potential problem in this code snippet?
#include <mutex>
#include <map>
#include <vector>
#include <thread>
constexpr int FOO_NUM = 5;
int main()
{
std::map<i...
John
Votes: 0
Answers: 2