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 88
99int main ()
1010{
11- std::atomic< uint64_t > counter;
12- counter = 0 ;
11+ // Local variable to be used within the loopThread
12+ uint64_t counter = 0 ;
1313 std::promise<int > pro;
1414 auto ft = pro.get_future ();
1515 trantor::EventLoopThread loopThread;
@@ -20,7 +20,7 @@ int main()
2020 {
2121 loop->queueInLoop ([&counter, &pro]() {
2222 ++counter;
23- if (counter. load () == 110000 )
23+ if (counter == 110000 )
2424 pro.set_value (1 );
2525 });
2626 }
@@ -32,13 +32,13 @@ int main()
3232 {
3333 loop->runInLoop ([&counter, &pro]() {
3434 ++counter;
35- if (counter. load () == 110000 )
35+ if (counter == 110000 )
3636 pro.set_value (1 );
3737 });
3838 }
3939 }).detach ();
4040 }
4141 loopThread.run ();
4242 ft.get ();
43- std::cout << " counter=" << counter. load () << std::endl;
43+ std::cout << " counter=" << counter << std::endl;
4444}
You can’t perform that action at this time.
0 commit comments