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>
|
2003-07-09 Christian Stimming <stimming@tuhh.de>
|
||||||
|
|
||||||
* README: Added remark about gnucash-docs.
|
* README: Added remark about gnucash-docs.
|
||||||
|
33
configure.in
33
configure.in
@ -73,17 +73,28 @@ AM_PROG_LIBTOOL
|
|||||||
|
|
||||||
AC_SUBST(LIBTOOL_DEPS)
|
AC_SUBST(LIBTOOL_DEPS)
|
||||||
|
|
||||||
# checks for pthreads
|
# # checks for the pthreads library
|
||||||
ACX_PTHREAD([enable_threads="pthread"],[enable_threads="no"])
|
# have_pthread=no
|
||||||
if test $enable_threads != "pthread"; then
|
# for i in pthreads lthread pthread; do
|
||||||
AC_MSG_ERROR([unable to find pthreads, currently this is required])
|
# if test "x$have_pthread" = xno; then
|
||||||
else
|
# AC_CHECK_LIB($i, pthread_once, [
|
||||||
AC_DEFINE(HAVE_PTHREAD,1,
|
# PTHREAD_LIBS=-l$i
|
||||||
[Define if you have POSIX threads libraries and header files.])
|
# have_pthread=yes
|
||||||
LIBS="$PTHREAD_LIBS $LIBS"
|
# ])
|
||||||
CFLAGS="$PTHREAD_CFLAGS $CFLAGS"
|
# fi
|
||||||
CXXFLAGS="$PTHREAD_CFLAGS $CXXFLAGS"
|
# done
|
||||||
fi
|
#
|
||||||
|
# # 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_ISC_POSIX
|
||||||
AC_C_BIGENDIAN
|
AC_C_BIGENDIAN
|
||||||
|
@ -74,7 +74,9 @@ fi
|
|||||||
# C compiler flags, and other items are library names, except for "none"
|
# C compiler flags, and other items are library names, except for "none"
|
||||||
# which indicates that we try without any flags at all.
|
# 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
|
# The ordering *is* (sometimes) important. Some notes on the
|
||||||
# individual items follow:
|
# individual items follow:
|
||||||
|
@ -31,7 +31,6 @@
|
|||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include <pthread.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -59,9 +58,12 @@ static gboolean guid_initialized = FALSE;
|
|||||||
static struct md5_ctx guid_context;
|
static struct md5_ctx guid_context;
|
||||||
static GMemChunk *guid_memchunk = NULL;
|
static GMemChunk *guid_memchunk = NULL;
|
||||||
|
|
||||||
|
#if USING_THREADS
|
||||||
/* guid_to_string uses a thread local buffer. These are used to set it up */
|
/* 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_key_t guid_buffer_key;
|
||||||
static pthread_once_t guid_buffer_key_once = PTHREAD_ONCE_INIT;
|
static pthread_once_t guid_buffer_key_once = PTHREAD_ONCE_INIT;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* This static indicates the debugging module that this .o belongs to. */
|
/* This static indicates the debugging module that this .o belongs to. */
|
||||||
static short module = MOD_ENGINE;
|
static short module = MOD_ENGINE;
|
||||||
@ -541,19 +543,25 @@ badstring:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate the key */
|
/* Allocate the key */
|
||||||
|
#if USING_THREADS
|
||||||
static void guid_buffer_key_alloc(void)
|
static void guid_buffer_key_alloc(void)
|
||||||
{
|
{
|
||||||
pthread_key_create(&guid_buffer_key, NULL /* Never freed */);
|
pthread_key_create(&guid_buffer_key, NULL /* Never freed */);
|
||||||
pthread_setspecific(guid_buffer_key, malloc(GUID_ENCODING_LENGTH+1));
|
pthread_setspecific(guid_buffer_key, malloc(GUID_ENCODING_LENGTH+1));
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
guid_to_string(const GUID * guid)
|
guid_to_string(const GUID * guid)
|
||||||
{
|
{
|
||||||
|
#if USING_THREADS
|
||||||
char *string;
|
char *string;
|
||||||
|
|
||||||
pthread_once(&guid_buffer_key_once, guid_buffer_key_alloc);
|
pthread_once(&guid_buffer_key_once, guid_buffer_key_alloc);
|
||||||
string = pthread_getspecific(guid_buffer_key);
|
string = pthread_getspecific(guid_buffer_key);
|
||||||
|
#else
|
||||||
|
static char string[64];
|
||||||
|
#endif
|
||||||
|
|
||||||
encode_md5_data(guid->data, string);
|
encode_md5_data(guid->data, string);
|
||||||
string[GUID_ENCODING_LENGTH] = '\0';
|
string[GUID_ENCODING_LENGTH] = '\0';
|
||||||
|
Loading…
Reference in New Issue
Block a user