OverviewFilesCommitsIssuesDocsReleasesPeers

opencog-atomspace-cog commits / 03ae638

Add some barrier synchronization point paranoia
03ae6385b91f9bd136e34c7b27ee93417dd8a075
by Linas Vepštas <linasvepstas@gmail.com> · 2025-12-14T21:49:55.000Z

Changed files (2) +10 -0

opencog/persist/cog-simple/CogSimpleStorage.cc +8 -0
……@@ -228,6 +228,14 @@ void CogSimpleStorage::proxy_open(void)
228228
229229void CogSimpleStorage::proxy_close(void)
230230{
231 // The barrier forces the cogserver to finish processing before
232 // the proxy-close. The proxy-close in turn acts like a sync
233 // point, causing all commands (e.g. set-value!) to complete
234 // before the close takes effect. That is, it turns the close
235 // itself into a sync point. On a single-threaded socket, like
236 // the one used here for CogSimpleStorage, it's not really needed
237 // But I'm going to get paranoid about this, for now.
238 barrier();
231239 do_send("(cog-proxy-close)\n");
232240 do_recv();
233241}
opencog/persist/cog-storage/CogIO.cc +2 -0
……@@ -47,6 +47,7 @@ using namespace opencog;
4747void CogStorage::proxy_open(void)
4848{
4949 Pkt pkt;
50 _io_queue.barrier();
5051 _io_queue.enqueue(this, "(cog-proxy-open)\n", pkt, &CogStorage::noop_const);
5152 _io_queue.barrier();
5253}
……@@ -54,6 +55,7 @@ void CogStorage::proxy_open(void)
5455void CogStorage::proxy_close(void)
5556{
5657 Pkt pkt;
58 _io_queue.barrier();
5759 _io_queue.enqueue(this, "(cog-proxy-close)\n", pkt, &CogStorage::noop_const);
5860 _io_queue.barrier();
5961}