File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ but others are unique.
2424
2525### The problem
2626
27- Let us launch a hundred coroutines all doing the same action thousand times.
27+ Let us launch a hundred coroutines all doing the same action a thousand times.
2828We'll also measure their completion time for further comparisons:
2929
3030<div class =" sample " markdown =" 1 " theme =" idea " data-highlight-only >
@@ -102,7 +102,7 @@ increment the `counter` concurrently from multiple threads without any synchroni
102102
103103### Volatiles are of no help
104104
105- There is common misconception that making a variable ` volatile ` solves concurrency problem. Let us try it:
105+ There is a common misconception that making a variable ` volatile ` solves concurrency problem. Let us try it:
106106
107107<!-- - CLEAR -->
108108
@@ -158,7 +158,7 @@ do not provide atomicity of larger actions (increment in our case).
158158### Thread-safe data structures
159159
160160The general solution that works both for threads and for coroutines is to use a thread-safe (aka synchronized,
161- linearizable, or atomic) data structure that provides all the necessarily synchronization for the corresponding
161+ linearizable, or atomic) data structure that provides all the necessary synchronization for the corresponding
162162operations that needs to be performed on a shared state.
163163In the case of a simple counter we can use ` AtomicInteger ` class which has atomic ` incrementAndGet ` operations:
164164
You can’t perform that action at this time.
0 commit comments