Importing in main tree this library which used to be in tests tree
[mmondor.git] / mmsoftware / pthread_util / mm_pthread_debug.h
CommitLineData
c6268fe8
MM
1/* $Id: mm_pthread_debug.h,v 1.1 2007/03/13 19:37:22 mmondor Exp $ */
2
3/*
4 * Copyright (C) 2004-2005, Matthew Mondor
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. All advertising materials mentioning features or use of this software
16 * must display the following acknowledgement:
17 * This product includes software developed by Matthew Mondor.
18 * 4. The name of Matthew Mondor may not be used to endorse or promote
19 * products derived from this software without specific prior written
20 * permission.
21 * 5. Redistribution of source code may not be released under the terms of
22 * any GNU Public License derivate.
23 *
24 * THIS SOFTWARE IS PROVIDED BY MATTHEW MONDOR ``AS IS'' AND ANY EXPRESS OR
25 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
26 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
27 * IN NO EVENT SHALL MATTHEW MONDOR BE LIABLE FOR ANY DIRECT, INDIRECT,
28 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
29 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
30 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
33 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 */
35
36
37
38#ifndef MM_PTHREAD_DEBUG_H
39#define MM_PTHREAD_DEBUG_H
40
41
42
43#include <pthread.h>
44#include <syslog.h>
45
46
47
48#ifdef PTHREAD_DEBUG
49
50#define DEBUG_PTHREAD_ENTRY() \
51 syslog(LOG_NOTICE, "> TID=%p FN=%s", pthread_self(), __func__)
52
53#define DEBUG_PTHREAD_EXIT() \
54 syslog(LOG_NOTICE, "< TID=%p FN=%s", pthread_self(), __func__)
55
56#else
57#define DEBUG_PTHREAD_ENTRY()
58#define DEBUG_PTHREAD_EXIT()
59#endif
60
61
62
63#endif