Mercurial > hg > MonetDB
changeset 86181:82fb8db73864 Jul2021
Turn BBPlogno and BBPtransid into atomics.
| author | Sjoerd Mullender <sjoerd@acm.org> |
|---|---|
| date | Thu, 28 Jul 2022 10:33:07 +0200 |
| parents | ede5229fbf99 |
| children | daeb22fc015d 9b9e105ed339 |
| files | gdk/gdk_bbp.c |
| diffstat | 1 files changed, 8 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/gdk/gdk_bbp.c +++ b/gdk/gdk_bbp.c @@ -131,8 +131,10 @@ static BAT *getBBPdescriptor(bat i, bool static gdk_return BBPbackup(BAT *b, bool subcommit); static gdk_return BBPdir_init(void); -static lng BBPlogno; /* two lngs of extra info in BBP.dir */ -static lng BBPtransid; +/* two lngs of extra info in BBP.dir */ +/* these two need to be atomic because of their use in AUTHcommit() */ +static ATOMIC_TYPE BBPlogno = ATOMIC_VAR_INIT(0); +static ATOMIC_TYPE BBPtransid = ATOMIC_VAR_INIT(0); #ifdef HAVE_HGE /* start out by saying we have no hge, but as soon as we've seen one, @@ -177,13 +179,13 @@ getBBPsize(void) lng getBBPlogno(void) { - return BBPlogno; + return (lng) ATOMIC_GET(&BBPlogno); } lng getBBPtransid(void) { - return BBPtransid; + return (lng) ATOMIC_GET(&BBPtransid); } @@ -3837,8 +3839,8 @@ BBPsync(int cnt, bat *restrict subcommit /* AFTERMATH */ if (ret == GDK_SUCCEED) { - BBPlogno = logno; /* the new value */ - BBPtransid = transid; + ATOMIC_SET(&BBPlogno, logno); /* the new value */ + ATOMIC_SET(&BBPtransid, transid); backup_files = subcommit ? (backup_files - backup_subdir) : 0; backup_dir = backup_subdir = 0; if (GDKremovedir(0, DELDIR) != GDK_SUCCEED)
