OverviewFilesCommitsIssuesDocsReleasesPeers

opencog-matrix commits / c96fbcd

Return value should be the new atom.
c96fbcd84a65df009aa292375027345164673556
by Linas Vepstas <linasvepstas@gmail.com> · 2023-03-13T03:33:38.000Z

Changed files (1) +5 -2

opencog/matrix/count-api.scm +5 -2
……@@ -370,7 +370,9 @@
370370 ; FYI count-obj returns a pair which might be PAIR, or it
371371 ; might be a copy of PAIR. If its a copy, its in a different
372372 ; AtomSpace. Store that one, and not the original.
373 (store-value (count-obj 'set-count PAIR CNT) cnt-key))
373 (define npr (count-obj 'set-count PAIR CNT))
374 (store-value npr cnt-key)
375 npr)
374376
375377 ; Fully thread-safe fetch-and-increment.
376378 (define (inc-count PAIR CNT)
……@@ -387,7 +389,8 @@
387389 (unlock-mutex mtx)
388390 npr))
389391 (count-obj 'inc-count PAIR CNT)))
390 (store-value ipr cnt-key))
392 (store-value ipr cnt-key)
393 ipr)
391394
392395 ; Return the observed count for the pair (L-ATOM, R-ATOM).
393396 ; Be careful to not create tha pair, if it doesn't exist.