since changing the malloc spinlock to a mutex, it gets roped into the
rthread_debug print outs, which contribute massive noise. bypass the logging.
Index: rthread.h
===================================================================
RCS file: /cvs/src/lib/librthread/rthread.h,v
retrieving revision 1.58
diff -u -p -r1.58 rthread.h
--- rthread.h 7 May 2016 19:05:22 -0000 1.58
+++ rthread.h 1 Jun 2016 04:29:59 -0000
@@ -210,6 +210,11 @@ void _rthread_dl_lock(int what);
#endif
void _thread_malloc_reinit(void);
+int _rthread_mutex_lock(pthread_mutex_t *mutexp, int trywait,
+ const struct timespec *abstime, int internal);
+int _rthread_mutex_unlock(pthread_mutex_t *mutexp, int internal);
+
+
extern int _threads_ready;
extern size_t _thread_pagesize;
extern LIST_HEAD(listhead, pthread) _thread_list;
Index: rthread_libc.c
===================================================================
RCS file: /cvs/src/lib/librthread/rthread_libc.c,v
retrieving revision 1.14
diff -u -p -r1.14 rthread_libc.c
--- rthread_libc.c 7 May 2016 19:05:22 -0000 1.14
+++ rthread_libc.c 1 Jun 2016 04:30:41 -0000
@@ -166,13 +166,13 @@ static pthread_mutex_t malloc_mutex = &m
void
_thread_malloc_lock(void)
{
- pthread_mutex_lock(&malloc_mutex);
+ _rthread_mutex_lock(&malloc_mutex, 0, NULL, 1);
}
void
_thread_malloc_unlock(void)
{
- pthread_mutex_unlock(&malloc_mutex);
+ _rthread_mutex_unlock(&malloc_mutex, 1);
}
void
Index: rthread_sync.c
===================================================================
RCS file: /cvs/src/lib/librthread/rthread_sync.c,v
retrieving revision 1.42
diff -u -p -r1.42 rthread_sync.c
--- rthread_sync.c 7 May 2016 19:05:22 -0000 1.42
+++ rthread_sync.c 1 Jun 2016 04:28:23 -0000
@@ -83,9 +83,9 @@ pthread_mutex_destroy(pthread_mutex_t *m
}
DEF_STD(pthread_mutex_destroy);
-static int
+int
_rthread_mutex_lock(pthread_mutex_t *mutexp, int trywait,
- const struct timespec *abstime)
+ const struct timespec *abstime, int internal)
{
struct pthread_mutex *mutex;
pthread_t self = pthread_self();
@@ -107,7 +107,8 @@ _rthread_mutex_lock(pthread_mutex_t *mut
}
mutex = (struct pthread_mutex *)*mutexp;
- _rthread_debug(5, "%p: mutex_lock %p\n", (void *)self, (void *)mutex);
+ if (!internal)
+ _rthread_debug(5, "%p: mutex_lock %p\n", (void *)self, (void
*)mutex);
_spinlock(&mutex->lock);
if (mutex->owner == NULL && TAILQ_EMPTY(&mutex->lockers)) {
assert(mutex->count == 0);
@@ -171,30 +172,31 @@ _rthread_mutex_lock(pthread_mutex_t *mut
int
pthread_mutex_lock(pthread_mutex_t *p)
{
- return (_rthread_mutex_lock(p, 0, NULL));
+ return (_rthread_mutex_lock(p, 0, NULL, 0));
}
DEF_STD(pthread_mutex_lock);
int
pthread_mutex_trylock(pthread_mutex_t *p)
{
- return (_rthread_mutex_lock(p, 1, NULL));
+ return (_rthread_mutex_lock(p, 1, NULL, 0));
}
int
pthread_mutex_timedlock(pthread_mutex_t *p, const struct timespec *abstime)
{
- return (_rthread_mutex_lock(p, 0, abstime));
+ return (_rthread_mutex_lock(p, 0, abstime, 0));
}
int
-pthread_mutex_unlock(pthread_mutex_t *mutexp)
+_rthread_mutex_unlock(pthread_mutex_t *mutexp, int internal)
{
pthread_t self = pthread_self();
struct pthread_mutex *mutex = (struct pthread_mutex *)*mutexp;
- _rthread_debug(5, "%p: mutex_unlock %p\n", (void *)self,
- (void *)mutex);
+ if (!internal)
+ _rthread_debug(5, "%p: mutex_unlock %p\n", (void *)self,
+ (void *)mutex);
if (mutex == NULL)
#if PTHREAD_MUTEX_DEFAULT == PTHREAD_MUTEX_ERRORCHECK
@@ -237,6 +239,12 @@ pthread_mutex_unlock(pthread_mutex_t *mu
}
return (0);
+}
+
+int
+pthread_mutex_unlock(pthread_mutex_t *p)
+{
+ return (_rthread_mutex_unlock(p, 0));
}
DEF_STD(pthread_mutex_unlock);