summaryrefslogtreecommitdiffstats
path: root/lib/libc/thread/rthread_debug.c
blob: 67dca29e054bb8ce7517d0130255d82a5391b216 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/* $OpenBSD: rthread_debug.c,v 1.3 2017/09/05 02:40:54 guenther Exp $ */

/* PUBLIC DOMAIN: No Rights Reserved. Marco S Hyman <marc@snafu.org> */

#include <pthread.h>
#include <stdarg.h>
#include <stdio.h>
#include <unistd.h>

#include "rthread.h"

/*
 * format and send output to stderr if the given "level" is less than or
 * equal to the current debug level.   Messages with a level <= 0 will
 * always be printed.
 */
void
_rthread_debug(int level, const char *fmt, ...)
{
	if (_rthread_debug_level >= level) {
		va_list ap;
		va_start(ap, fmt);
		vdprintf(STDERR_FILENO, fmt, ap);
		va_end(ap);
	}
}
DEF_STRONG(_rthread_debug);