remove shared counter
This commit is contained in:
parent
a5979db553
commit
a839c7dc3e
2
main.cpp
2
main.cpp
@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
static uint32_t SHARED_COUNTER = 0;
|
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
cout << "Hello World" << endl;
|
cout << "Hello World" << endl;
|
||||||
}
|
}
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
static uint32_t SHARED_COUNTER = 0;
|
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
cout << "Hello World" << endl;
|
cout << "Hello World" << endl;
|
||||||
}
|
}
|
||||||
|
@ -23,3 +23,9 @@ if you are completely new to concurrency in C++.
|
|||||||
is protected by a [`std::mutex`](https://en.cppreference.com/w/cpp/thread/mutex).
|
is protected by a [`std::mutex`](https://en.cppreference.com/w/cpp/thread/mutex).
|
||||||
You can also use the [`std::lock_guard`](https://en.cppreference.com/w/cpp/thread/lock_guard)
|
You can also use the [`std::lock_guard`](https://en.cppreference.com/w/cpp/thread/lock_guard)
|
||||||
which is a [RAII-style](https://en.cppreference.com/w/cpp/language/raii) helper object.
|
which is a [RAII-style](https://en.cppreference.com/w/cpp/language/raii) helper object.
|
||||||
|
|
||||||
|
# 2. Using messages
|
||||||
|
|
||||||
|
C++ does not really have an built-in message queue implementation.
|
||||||
|
We are going to use a `std::queue` in conjunction with a `std::mutex` to
|
||||||
|
have something similar to a message queue API.
|
||||||
|
Loading…
Reference in New Issue
Block a user