From: Tobias Oetiker Date: Wed, 22 Jul 2015 13:12:37 +0000 (+0200) Subject: allocate mutex globally ... that might work better X-Git-Tag: v1.5.4~23 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9c8e743530cd3ccfee90705e3b44f0fa019e04bc;p=thirdparty%2Frrdtool-1.x.git allocate mutex globally ... that might work better --- diff --git a/configure b/configure index dd8b95d7..056715c9 100755 --- a/configure +++ b/configure @@ -19931,6 +19931,240 @@ CORE_LIBS="$LIBS" if test $enable_rrd_graph != no; then + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + EX_CHECK_STATE=NO + ex_check_save_LIBS=${LIBS} + ex_check_save_CPPFLAGS=${CPPFLAGS} + ex_check_save_LDFLAGS=${LDFLAGS} + if test "x""" != "x"; then + CPPFLAGS="$CPPFLAGS -I""" + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for png_access_version_number in -lpng" >&5 +$as_echo_n "checking for png_access_version_number in -lpng... " >&6; } +if ${ac_cv_lib_png_png_access_version_number+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpng $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char png_access_version_number (); +int +main () +{ +return png_access_version_number (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_png_png_access_version_number=yes +else + ac_cv_lib_png_png_access_version_number=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_png_png_access_version_number" >&5 +$as_echo "$ac_cv_lib_png_png_access_version_number" >&6; } +if test "x$ac_cv_lib_png_png_access_version_number" = xyes; then : + + ac_fn_c_check_header_mongrel "$LINENO" "png.h" "ac_cv_header_png_h" "$ac_includes_default" +if test "x$ac_cv_header_png_h" = xyes; then : + LIBS="-lpng ${LIBS}";EX_CHECK_STATE=YES +fi + + +fi + + if test $EX_CHECK_STATE = NO; then + for ac_prog in pkg-config +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_PKGCONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$PKGCONFIG"; then + ac_cv_prog_PKGCONFIG="$PKGCONFIG" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_PKGCONFIG="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +PKGCONFIG=$ac_cv_prog_PKGCONFIG +if test -n "$PKGCONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKGCONFIG" >&5 +$as_echo "$PKGCONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$PKGCONFIG" && break +done +test -n "$PKGCONFIG" || PKGCONFIG="no" + + if test "$PKGCONFIG" != "no"; then + if $PKGCONFIG --exists libpng; then + CPPFLAGS=${CPPFLAGS}" "`$PKGCONFIG --cflags libpng` + LDFLAGS=${LDFLAGS}" "`$PKGCONFIG --libs-only-L libpng` + LDFLAGS=${LDFLAGS}" "`$PKGCONFIG --libs-only-other libpng` + LIBS=${LIBS}" "`$PKGCONFIG --libs-only-l libpng` + unset ac_cv_lib_`echo png | sed 's/[^_a-zA-Z0-9]/_/g;s/^[0-9]/_/'`_png_access_version_number + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for png_access_version_number in -lpng" >&5 +$as_echo_n "checking for png_access_version_number in -lpng... " >&6; } +if ${ac_cv_lib_png_png_access_version_number+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpng $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char png_access_version_number (); +int +main () +{ +return png_access_version_number (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_png_png_access_version_number=yes +else + ac_cv_lib_png_png_access_version_number=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_png_png_access_version_number" >&5 +$as_echo "$ac_cv_lib_png_png_access_version_number" >&6; } +if test "x$ac_cv_lib_png_png_access_version_number" = xyes; then : + + unset ac_cv_header_`echo png.h | sed 's/[^_a-zA-Z0-9]/_/g;s/^[0-9]/_/'` + ac_fn_c_check_header_mongrel "$LINENO" "png.h" "ac_cv_header_png_h" "$ac_includes_default" +if test "x$ac_cv_header_png_h" = xyes; then : + EX_CHECK_STATE=YES +fi + + + +fi + + else + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: +---------------------------------------------------------------------------- +* I found a copy of pkgconfig, but there is no libpng.pc file around. + You may want to set the PKG_CONFIG_PATH variable to point to its + location. +---------------------------------------------------------------------------- + " >&5 +$as_echo "$as_me: WARNING: +---------------------------------------------------------------------------- +* I found a copy of pkgconfig, but there is no libpng.pc file around. + You may want to set the PKG_CONFIG_PATH variable to point to its + location. +---------------------------------------------------------------------------- + " >&2;} + fi + fi + fi + + if test ${EX_CHECK_STATE} = NO; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: +---------------------------------------------------------------------------- +* I could not find a working copy of libpng. Check config.log for hints on why + this is the case. Maybe you need to set LDFLAGS and CPPFLAGS appropriately + so that compiler and the linker can find libpng and its header files. If + you have not installed libpng, you can get it either from its original home on + + ftp://ftp.simplesystems.org/pub/libpng/png/src/ + + You can find also find an archive copy on + + http://oss.oetiker.ch/rrdtool/pub/libs + + The last tested version of libpng is 1.4.8. + + LIBS=$LIBS + LDFLAGS=$LDFLAGS + CPPFLAGS=$CPPFLAGS + +---------------------------------------------------------------------------- + " >&5 +$as_echo "$as_me: WARNING: +---------------------------------------------------------------------------- +* I could not find a working copy of libpng. Check config.log for hints on why + this is the case. Maybe you need to set LDFLAGS and CPPFLAGS appropriately + so that compiler and the linker can find libpng and its header files. If + you have not installed libpng, you can get it either from its original home on + + ftp://ftp.simplesystems.org/pub/libpng/png/src/ + + You can find also find an archive copy on + + http://oss.oetiker.ch/rrdtool/pub/libs + + The last tested version of libpng is 1.4.8. + + LIBS=$LIBS + LDFLAGS=$LDFLAGS + CPPFLAGS=$CPPFLAGS + +---------------------------------------------------------------------------- + " >&2;} + EX_CHECK_ALL_ERR=YES + LIBS="${ex_check_save_LIBS}" + CPPFLAGS="${ex_check_save_CPPFLAGS}" + LDFLAGS="${ex_check_save_LDFLAGS}" + fi + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' diff --git a/src/rrd_parsetime.c b/src/rrd_parsetime.c index e02e27d9..c2ecbca8 100644 --- a/src/rrd_parsetime.c +++ b/src/rrd_parsetime.c @@ -833,11 +833,13 @@ static char *day( * mktime() The return value is either TIME_OK (aka NULL) or * the pointer to the error message in the case of problems */ + +static mutex_t parsetime_mutex = MUTEX_INITIALIZER; + char *rrd_parsetime( const char *tspec, rrd_time_value_t * ptv) { - static mutex_t parsetime_mutex = MUTEX_INITIALIZER; time_t now = time(NULL); int hr = 0;