Changeset: fe9d73aef611 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/fe9d73aef611
Modified Files:
gdk/gdk_system.c
Branch: Jun2023
Log Message:
Slightly different way of recording that limits can be overridden temporarily.
diffs (76 lines):
diff --git a/gdk/gdk_system.c b/gdk/gdk_system.c
--- a/gdk/gdk_system.c
+++ b/gdk/gdk_system.c
@@ -199,7 +199,7 @@ static struct winthread {
char algorithm[512]; /* the algorithm used in the last operation */
size_t algolen; /* length of string in .algorithm */
ATOMIC_TYPE exited;
- bool detached:1, waiting:1;
+ bool detached:1, waiting:1, limit_override:1;
char threadname[MT_NAME_LEN];
QryCtx *qry_ctx;
} *winthreads = NULL;
@@ -405,8 +405,15 @@ MT_thread_setworking(const char *work)
return;
struct winthread *w = TlsGetValue(threadslot);
- if (w)
- w->working = work;
+ if (w) {
+ if (work == NULL)
+ w->working = NULL;
+ else if (strcmp(work, "store locked") == 0)
+ w->limit_override = true;
+ else if (strcmp(work, "store unlocked") == 0)
+ w->limit_override = false;
+ else
+ w->working = work;
}
void
@@ -447,7 +454,7 @@ MT_thread_override_limits(void)
return false;
struct winthread *w = TlsGetValue(threadslot);
- return w && w->working && strcmp(w->working, "store locked") == 0;
+ return w && w->limit_override;
}
static void
@@ -673,7 +680,7 @@ static struct posthread {
pthread_t tid;
MT_Id mtid;
ATOMIC_TYPE exited;
- bool detached:1, waiting:1;
+ bool detached:1, waiting:1, limit_override:1;
QryCtx *qry_ctx;
} *posthreads = NULL;
static struct posthread mainthread = {
@@ -880,8 +887,16 @@ MT_thread_setworking(const char *work)
return;
struct posthread *p = pthread_getspecific(threadkey);
- if (p)
- p->working = work;
+ if (p) {
+ if (work == NULL)
+ p->working = NULL;
+ else if (strcmp(work, "store locked") == 0)
+ p->limit_override = true;
+ else if (strcmp(work, "store unlocked") == 0)
+ p->limit_override = false;
+ else
+ p->working = work;
+ }
}
void
@@ -922,7 +937,7 @@ MT_thread_override_limits(void)
return false;
struct posthread *p = pthread_getspecific(threadkey);
- return p && p->working && strcmp(p->working, "store locked") == 0;
+ return p && p->limit_override;
}
#ifdef HAVE_PTHREAD_SIGMASK
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]