Changeset: 8cf743a7f262 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/8cf743a7f262
Modified Files:
gdk/gdk_bat.c
gdk/gdk_bbp.c
gdk/gdk_private.h
gdk/gdk_tm.c
gdk/gdk_utils.c
Branch: Sep2022
Log Message:
Merge with Jan2022 branch.
diffs (85 lines):
diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -267,40 +267,6 @@ static volatile MT_Id locked_by = 0;
static int BBPunloadCnt = 0;
static MT_Lock GDKunloadLock = MT_LOCK_INITIALIZER(GDKunloadLock);
-/* GDKtmLock protects all accesses and changes to BAKDIR and SUBDIR
- * must use BBPtmlock()/BBPtmunlock() to set/unset the lock */
-static MT_Lock GDKtmLock = MT_LOCK_INITIALIZER(GDKtmLock);
-static char *lockfile;
-static int lockfd;
-
-void
-BBPtmlock(void)
-{
- MT_lock_set(&GDKtmLock);
- if (GDKinmemory(0))
- return;
- /* also use an external lock file to synchronize with external
- * programs */
- if (lockfile == NULL) {
- lockfile = GDKfilepath(0, NULL, ".tm_lock", NULL);
- if (lockfile == NULL)
- return;
- }
- lockfd = MT_lockf(lockfile, F_LOCK);
-}
-
-void
-BBPtmunlock(void)
-{
- if (lockfile && lockfd >= 0) {
- assert(!GDKinmemory(0));
- MT_lockf(lockfile, F_ULOCK);
- close(lockfd);
- lockfd = -1;
- }
- MT_lock_unset(&GDKtmLock);
-}
-
void
BBPlock(void)
{
@@ -4611,3 +4577,40 @@ BBPcallbacks(void)
}
MT_lock_unset(&GDKCallbackListLock);
}
+
+/* GDKtmLock protects all accesses and changes to BAKDIR and SUBDIR.
+ * MUST use BBPtmlock()/BBPtmunlock() to set/unset the lock.
+ *
+ * This is at the end of the file on purpose: we don't want people to
+ * accidentally use GDKtmLock directly. */
+static MT_Lock GDKtmLock = MT_LOCK_INITIALIZER(GDKtmLock);
+static char *lockfile;
+static int lockfd;
+
+void
+BBPtmlock(void)
+{
+ MT_lock_set(&GDKtmLock);
+ if (GDKinmemory(0))
+ return;
+ /* also use an external lock file to synchronize with external
+ * programs */
+ if (lockfile == NULL) {
+ lockfile = GDKfilepath(0, NULL, ".tm_lock", NULL);
+ if (lockfile == NULL)
+ return;
+ }
+ lockfd = MT_lockf(lockfile, F_LOCK);
+}
+
+void
+BBPtmunlock(void)
+{
+ if (lockfile && lockfd >= 0) {
+ assert(!GDKinmemory(0));
+ MT_lockf(lockfile, F_ULOCK);
+ close(lockfd);
+ lockfd = -1;
+ }
+ MT_lock_unset(&GDKtmLock);
+}
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]