Run clang-format
This commit is contained in:
@@ -1,22 +1,23 @@
|
||||
#include <vector>
|
||||
#include <atomic>
|
||||
#include <iostream>
|
||||
#include <chrono>
|
||||
#include <iostream>
|
||||
#include <thread>
|
||||
#include <vector>
|
||||
|
||||
std::vector<int> data;
|
||||
std::atomic_bool data_ready(false);
|
||||
|
||||
void reader_thread()
|
||||
void
|
||||
reader_thread()
|
||||
{
|
||||
while(!data_ready.load())
|
||||
{
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||
}
|
||||
std::cout<<"The answer="<<data[0]<<"\n";
|
||||
while (!data_ready.load()) {
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||
}
|
||||
std::cout << "The answer=" << data[0] << "\n";
|
||||
}
|
||||
void writer_thread()
|
||||
void
|
||||
writer_thread()
|
||||
{
|
||||
data.push_back(42);
|
||||
data_ready=true;
|
||||
data.push_back(42);
|
||||
data_ready = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user