File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change 8
8
9
9
int main ()
10
10
{
11
- std::atomic< uint64_t > counter;
12
- counter = 0 ;
11
+ // Local variable to be used within the loopThread
12
+ uint64_t counter = 0 ;
13
13
std::promise<int > pro;
14
14
auto ft = pro.get_future ();
15
15
trantor::EventLoopThread loopThread;
@@ -20,7 +20,7 @@ int main()
20
20
{
21
21
loop->queueInLoop ([&counter, &pro]() {
22
22
++counter;
23
- if (counter. load () == 110000 )
23
+ if (counter == 110000 )
24
24
pro.set_value (1 );
25
25
});
26
26
}
@@ -32,13 +32,13 @@ int main()
32
32
{
33
33
loop->runInLoop ([&counter, &pro]() {
34
34
++counter;
35
- if (counter. load () == 110000 )
35
+ if (counter == 110000 )
36
36
pro.set_value (1 );
37
37
});
38
38
}
39
39
}).detach ();
40
40
}
41
41
loopThread.run ();
42
42
ft.get ();
43
- std::cout << " counter=" << counter. load () << std::endl;
43
+ std::cout << " counter=" << counter << std::endl;
44
44
}
You can’t perform that action at this time.
0 commit comments