123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- #include "sys-defines.h"
- #include "extern.h"
- #ifdef PTHREAD_SUPPORT
- #ifdef HAVE_PTHREAD_H
- pthread_mutex_t _message_mutex = PTHREAD_MUTEX_INITIALIZER;
- #endif
- #endif
- extern int (*pl_libplot_warning_handler) (const char *msg);
- extern int (*pl_libplot_error_handler) (const char *msg);
- void
- _pl_g_warning (R___(Plotter *_plotter) const char *msg)
- {
- #ifdef PTHREAD_SUPPORT
- #ifdef HAVE_PTHREAD_H
-
- pthread_mutex_lock (&_message_mutex);
- #endif
- #endif
- if (pl_libplot_warning_handler != NULL)
- (*pl_libplot_warning_handler)(msg);
- else if (_plotter->data->errfp)
- fprintf (_plotter->data->errfp, "libplot: %s\n", msg);
- #ifdef LIBPLOTTER
- else if (_plotter->data->errstream)
- (*(_plotter->data->errstream)) << "libplot: " << msg << '\n';
- #endif
- #ifdef PTHREAD_SUPPORT
- #ifdef HAVE_PTHREAD_H
-
- pthread_mutex_unlock (&_message_mutex);
- #endif
- #endif
- }
- void
- _pl_g_error (R___(Plotter *_plotter) const char *msg)
- {
- #ifdef PTHREAD_SUPPORT
- #ifdef HAVE_PTHREAD_H
-
- pthread_mutex_lock (&_message_mutex);
- #endif
- #endif
- if (pl_libplot_error_handler != NULL)
- (*pl_libplot_error_handler)(msg);
- else if (_plotter->data->errfp)
- fprintf (_plotter->data->errfp, "libplot error: %s\n", msg);
- #ifdef LIBPLOTTER
- else if (_plotter->data->errstream)
- (*(_plotter->data->errstream)) << "libplot error: " << msg << '\n';
- #endif
- #ifdef PTHREAD_SUPPORT
- #ifdef HAVE_PTHREAD_H
-
- pthread_mutex_unlock (&_message_mutex);
- #endif
- #endif
- }
|