Changeset: cb94603265f9 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=cb94603265f9
Modified Files:
clients/Tests/exports.stable.out
gdk/gdk_utils.c
gdk/gdk_utils.h
Branch: default
Log Message:
Removed GDKregister.
diffs (99 lines):
diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out
--- a/clients/Tests/exports.stable.out
+++ b/clients/Tests/exports.stable.out
@@ -274,7 +274,6 @@ int GDKnr_threads;
void GDKprepareExit(void);
void GDKqsort(void *restrict h, void *restrict t, const void *restrict base,
size_t n, int hs, int ts, int tpe, bool reverse, bool nilslast);
void *GDKrealloc(void *pold, size_t size) __attribute__((__alloc_size__(2)))
__attribute__((__warn_unused_result__));
-void GDKregister(MT_Id pid);
gdk_return GDKreleasemmap(void *ptr, size_t size, size_t id);
gdk_return GDKreleasesem(int sem_id);
void GDKreset(int status);
diff --git a/gdk/gdk_utils.c b/gdk/gdk_utils.c
--- a/gdk/gdk_utils.c
+++ b/gdk/gdk_utils.c
@@ -754,51 +754,19 @@ GDKexiting(void)
return (bool) (ATOMIC_GET(&GDKstopped) > 0);
}
-struct serverthread {
- struct serverthread *next;
- MT_Id pid;
-};
-static ATOMIC_PTR_TYPE serverthread = ATOMIC_PTR_VAR_INIT(NULL);
-
void
GDKprepareExit(void)
{
- struct serverthread *st;
-
if (ATOMIC_ADD(&GDKstopped, 1) > 0)
return;
THRDDEBUG dump_threads();
- /* we're saved from the ABA problem in this code because it is
- * only executed by one thread */
- while ((st = ATOMIC_PTR_GET(&serverthread)) != NULL) {
- while (!ATOMIC_PTR_CAS(&serverthread, &((void *) {st}),
st->next))
- ;
- MT_join_thread(st->pid);
- GDKfree(st);
- }
join_detached_threads();
}
-/* Register a thread that should be waited for in GDKreset. The
- * thread must exit by itself when GDKexiting() returns true. */
-void
-GDKregister(MT_Id pid)
-{
- struct serverthread *st;
-
- if ((st = GDKmalloc(sizeof(struct serverthread))) == NULL)
- return;
- st->pid = pid;
- st->next = ATOMIC_PTR_GET(&serverthread);
- while (!ATOMIC_PTR_CAS(&serverthread, &((void *) {st->next}), st))
- ;
-}
-
void
GDKreset(int status)
{
- struct serverthread *st;
MT_Id pid = MT_getpid();
assert(GDKexiting());
@@ -812,21 +780,12 @@ GDKreset(int status)
GDKval = NULL;
}
- /* we're saved from the ABA problem in this code because it is
- * only executed by one thread */
- while ((st = ATOMIC_PTR_GET(&serverthread)) != NULL) {
- while (!ATOMIC_PTR_CAS(&serverthread, &((void *) {st}),
st->next))
- ;
- MT_join_thread(st->pid);
- GDKfree(st);
- }
join_detached_threads();
if (status == 0) {
/* they had their chance, now kill them */
bool killed = false;
MT_lock_set(&GDKthreadLock);
- assert(ATOMIC_PTR_GET(&serverthread) == NULL);
for (Thread t = GDKthreads; t < GDKthreads + THREADS; t++) {
MT_Id victim;
if ((victim = (MT_Id) ATOMIC_GET(&t->pid)) != 0) {
diff --git a/gdk/gdk_utils.h b/gdk/gdk_utils.h
--- a/gdk/gdk_utils.h
+++ b/gdk/gdk_utils.h
@@ -89,7 +89,6 @@ gdk_export void GDKexit(int status);
#endif
gdk_export bool GDKexiting(void);
-gdk_export void GDKregister(MT_Id pid);
gdk_export void GDKprepareExit(void);
gdk_export void GDKreset(int status);
gdk_export const char *GDKversion(void);
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list