Home | History | Annotate | Download | only in pthread_mutex_lock
      1 /*
      2  * Copyright (c) 2004, Bull S.A..  All rights reserved.
      3  * Created by: Sebastien Decugis
      4 
      5  * This program is free software; you can redistribute it and/or modify it
      6  * under the terms of version 2 of the GNU General Public License as
      7  * published by the Free Software Foundation.
      8  *
      9  * This program is distributed in the hope that it would be useful, but
     10  * WITHOUT ANY WARRANTY; without even the implied warranty of
     11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     12  *
     13  * You should have received a copy of the GNU General Public License along
     14  * with this program; if not, write the Free Software Foundation, Inc.,
     15  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
     16  *
     17 
     18  * This file is a wrapper to use the tests from the NPTL Test & Trace Project
     19  * with either the Linux Test Project or the Open POSIX Test Suite.
     20 
     21  * The following function are defined:
     22  * void output_init()
     23  * void output_fini()
     24  * void output(char * string, ...)
     25  *
     26  * The are used to output informative text (as a printf).
     27  */
     28 
     29 /* We use a mutex to avoid conflicts in traces */
     30 static pthread_mutex_t m_trace = PTHREAD_MUTEX_INITIALIZER;
     31 
     32 /*****************************************************************************************/
     33 /******************************* stdout module *****************************************/
     34 /*****************************************************************************************/
     35 /* The following functions will output to stdout */
     36 #if (1)
     37 void output_init()
     38 {
     39 	/* do nothing */
     40 	return;
     41 }
     42 
     43 void output(char *string, ...)
     44 {
     45 	va_list ap;
     46 	pthread_mutex_lock(&m_trace);
     47 	va_start(ap, string);
     48 	vprintf(string, ap);
     49 	va_end(ap);
     50 	pthread_mutex_unlock(&m_trace);
     51 }
     52 
     53 void output_fini()
     54 {
     55 	/*do nothing */
     56 	return;
     57 }
     58 #endif
     59