OverviewFilesCommitsIssuesDocsReleasesPeers

opencog-cogutil commits / c435ac7

Only the last guy needs to notify
c435ac70538b6e804a83badded3511bb9d9db8c0
by Linas Vepstas <linasvepstas@gmail.com> · 2025-12-07T19:48:01.000Z

Changed files (1) +6 -3

opencog/util/async_buffer.h +6 -3
……@@ -499,10 +499,13 @@ void async_buffer<Writer, Element>::write_loop()
499499 if (_current_barrier != nullptr)
500500 {
501501 (_writer->*_do_write)(*_current_barrier);
502 _barrier_count--;
503 _barrier_count.notify_all();
504502
505 // Wait for barrier to complete
503 unsigned int old_count = _barrier_count.fetch_sub(1);
504 if (2 == old_count)
505 _barrier_count.notify_all();
506
507 // barrier() will drop the count to zero after
508 // all workers have run.
506509 unsigned cnt = _barrier_count.load();
507510 while (0 < cnt)
508511 {