mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
* configure.in: change (and comment out) checks for pthreads
* macros/acx_pthread.m4: change pthread search (should be removed) * src/engine/guid.c: remove pthread code and just use a static buffer. (pthread code is kept within some #ifdef's, just in case we decide to put it back in later). git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@8846 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
e1ce34c9e5
commit
743889ead0
@ -1,3 +1,11 @@
|
||||
2003-07-09 Derek Atkins <derek@ihtfp.com>
|
||||
|
||||
* configure.in: change (and comment out) checks for pthreads
|
||||
* macros/acx_pthread.m4: change pthread search (should be removed)
|
||||
* src/engine/guid.c: remove pthread code and just use a static buffer.
|
||||
(pthread code is kept within some #ifdef's, just in case we decide to
|
||||
put it back in later).
|
||||
|
||||
2003-07-09 Christian Stimming <stimming@tuhh.de>
|
||||
|
||||
* README: Added remark about gnucash-docs.
|
||||
|
33
configure.in
33
configure.in
@ -73,17 +73,28 @@ AM_PROG_LIBTOOL
|
||||
|
||||
AC_SUBST(LIBTOOL_DEPS)
|
||||
|
||||
# checks for pthreads
|
||||
ACX_PTHREAD([enable_threads="pthread"],[enable_threads="no"])
|
||||
if test $enable_threads != "pthread"; then
|
||||
AC_MSG_ERROR([unable to find pthreads, currently this is required])
|
||||
else
|
||||
AC_DEFINE(HAVE_PTHREAD,1,
|
||||
[Define if you have POSIX threads libraries and header files.])
|
||||
LIBS="$PTHREAD_LIBS $LIBS"
|
||||
CFLAGS="$PTHREAD_CFLAGS $CFLAGS"
|
||||
CXXFLAGS="$PTHREAD_CFLAGS $CXXFLAGS"
|
||||
fi
|
||||
# # checks for the pthreads library
|
||||
# have_pthread=no
|
||||
# for i in pthreads lthread pthread; do
|
||||
# if test "x$have_pthread" = xno; then
|
||||
# AC_CHECK_LIB($i, pthread_once, [
|
||||
# PTHREAD_LIBS=-l$i
|
||||
# have_pthread=yes
|
||||
# ])
|
||||
# fi
|
||||
# done
|
||||
#
|
||||
# # Hmm, maybe it's just in libc?
|
||||
# if test "x$have_pthread" = xno; then
|
||||
# AC_CHECK_FUNC(pthread_once, [ have_pthread=yes ])
|
||||
# fi
|
||||
#
|
||||
# # Do we HAVE threads?!?
|
||||
# if test "x$have_pthread" = xno; then
|
||||
# AC_MSG_ERROR([unable to find pthreads on your system. Sorry.])
|
||||
# fi
|
||||
#
|
||||
# AC_SUBST(PTHREAD_LIBS)
|
||||
|
||||
AC_ISC_POSIX
|
||||
AC_C_BIGENDIAN
|
||||
|
@ -74,7 +74,9 @@ fi
|
||||
# C compiler flags, and other items are library names, except for "none"
|
||||
# which indicates that we try without any flags at all.
|
||||
|
||||
acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt"
|
||||
#acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt"
|
||||
|
||||
acx_pthread_flags="pthreads none lthread pthread"
|
||||
|
||||
# The ordering *is* (sometimes) important. Some notes on the
|
||||
# individual items follow:
|
||||
|
@ -31,7 +31,6 @@
|
||||
#include <ctype.h>
|
||||
#include <dirent.h>
|
||||
#include <glib.h>
|
||||
#include <pthread.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
@ -59,9 +58,12 @@ static gboolean guid_initialized = FALSE;
|
||||
static struct md5_ctx guid_context;
|
||||
static GMemChunk *guid_memchunk = NULL;
|
||||
|
||||
#if USING_THREADS
|
||||
/* guid_to_string uses a thread local buffer. These are used to set it up */
|
||||
#include <pthread.h>
|
||||
static pthread_key_t guid_buffer_key;
|
||||
static pthread_once_t guid_buffer_key_once = PTHREAD_ONCE_INIT;
|
||||
#endif
|
||||
|
||||
/* This static indicates the debugging module that this .o belongs to. */
|
||||
static short module = MOD_ENGINE;
|
||||
@ -541,19 +543,25 @@ badstring:
|
||||
}
|
||||
|
||||
/* Allocate the key */
|
||||
#if USING_THREADS
|
||||
static void guid_buffer_key_alloc(void)
|
||||
{
|
||||
pthread_key_create(&guid_buffer_key, NULL /* Never freed */);
|
||||
pthread_setspecific(guid_buffer_key, malloc(GUID_ENCODING_LENGTH+1));
|
||||
}
|
||||
#endif
|
||||
|
||||
const char *
|
||||
guid_to_string(const GUID * guid)
|
||||
{
|
||||
#if USING_THREADS
|
||||
char *string;
|
||||
|
||||
pthread_once(&guid_buffer_key_once, guid_buffer_key_alloc);
|
||||
string = pthread_getspecific(guid_buffer_key);
|
||||
#else
|
||||
static char string[64];
|
||||
#endif
|
||||
|
||||
encode_md5_data(guid->data, string);
|
||||
string[GUID_ENCODING_LENGTH] = '\0';
|
||||
|
Loading…
Reference in New Issue
Block a user