Changeset: 6dfd8ffb7ab2 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=6dfd8ffb7ab2
Modified Files:
gdk/gdk_system.c
monetdb5/mal/mal_profiler.c
Branch: default
Log Message:
Merge with Jun2016 branch.
diffs (87 lines):
diff --git a/gdk/gdk_system.c b/gdk/gdk_system.c
--- a/gdk/gdk_system.c
+++ b/gdk/gdk_system.c
@@ -477,14 +477,6 @@ rm_posthread_locked(struct posthread *p)
}
static void
-rm_posthread(struct posthread *p)
-{
- pthread_mutex_lock(&posthread_lock);
- rm_posthread_locked(p);
- pthread_mutex_unlock(&posthread_lock);
-}
-
-static void
thread_starter(void *arg)
{
struct posthread *p = (struct posthread *) arg;
@@ -574,10 +566,6 @@ MT_create_thread(MT_Id *t, void (*f) (vo
p->func = f;
p->arg = arg;
p->exited = 0;
- pthread_mutex_lock(&posthread_lock);
- p->next = posthreads;
- posthreads = p;
- pthread_mutex_unlock(&posthread_lock);
f = thread_starter;
arg = p;
newtp = &p->tid;
@@ -592,8 +580,13 @@ MT_create_thread(MT_Id *t, void (*f) (vo
#else
*t = (MT_Id) (((size_t) *newtp) + 1); /* use pthread-id + 1 */
#endif
+ if (p) {
+ pthread_mutex_lock(&posthread_lock);
+ p->next = posthreads;
+ posthreads = p;
+ pthread_mutex_unlock(&posthread_lock);
+ }
} else if (p) {
- rm_posthread(p);
free(p);
}
#ifdef HAVE_PTHREAD_SIGMASK
diff --git a/monetdb5/mal/mal_profiler.c b/monetdb5/mal/mal_profiler.c
--- a/monetdb5/mal/mal_profiler.c
+++ b/monetdb5/mal/mal_profiler.c
@@ -729,9 +729,9 @@ initTrace(void)
{
int ret = -1;
- MT_lock_set(&mal_contextLock);
+ MT_lock_set(&mal_profileLock);
if (TRACE_init) {
- MT_lock_unset(&mal_contextLock);
+ MT_lock_unset(&mal_profileLock);
return 0; /* already initialized */
}
TRACE_id_event = TRACEcreate("id", "event", TYPE_int);
@@ -767,23 +767,23 @@ initTrace(void)
else
TRACE_init = 1;
ret = TRACE_init;
- MT_lock_unset(&mal_contextLock);
+ MT_lock_unset(&mal_profileLock);
return ret;
}
void
clearTrace(void)
{
- MT_lock_set(&mal_contextLock);
+ MT_lock_set(&mal_profileLock);
if (TRACE_init == 0) {
- MT_lock_unset(&mal_contextLock);
+ MT_lock_unset(&mal_profileLock);
initTrace();
return; /* not initialized */
}
/* drop all trace tables */
_cleanupProfiler();
TRACE_init = 0;
- MT_lock_unset(&mal_contextLock);
+ MT_lock_unset(&mal_profileLock);
initTrace();
}
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list