Dont complain, if --without-threads or --with-threads=none is supplied;

1998-12-15  Sebastian Wilhelmi  <wilhelmi@ira.uka.de>

	* configure.in: Dont complain, if --without-threads or
	--with-threads=none is supplied; Test for pthread_attr_init
	instead of pthread_cond_init, if threads seems to be supported by
	standard glib. (CFLAGS): Use G_THREAD_CFLAGS for compiling of glib
	as well.

	* glib.h, gmutex.c: Changed private to private_key to avoid
	problems when compiling with under C++.
This commit is contained in:
Sebastian Wilhelmi 1998-12-15 17:50:47 +00:00 committed by Sebastian Wilhelmi
parent 2c30e8620f
commit d98c425676
12 changed files with 125 additions and 32 deletions

View File

@ -1,3 +1,14 @@
1998-12-15 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* configure.in: Dont complain, if --without-threads or
--with-threads=none is supplied; Test for pthread_attr_init
instead of pthread_cond_init, if threads seems to be supported by
standard glib. (CFLAGS): Use G_THREAD_CFLAGS for compiling of glib
as well.
* glib.h, gmutex.c: Changed private to private_key to avoid
problems when compiling with under C++.
1998-12-15 Jeff Garzik <jgarzik@Pobox.com> 1998-12-15 Jeff Garzik <jgarzik@Pobox.com>
* configure.in: * configure.in:

View File

@ -1,3 +1,14 @@
1998-12-15 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* configure.in: Dont complain, if --without-threads or
--with-threads=none is supplied; Test for pthread_attr_init
instead of pthread_cond_init, if threads seems to be supported by
standard glib. (CFLAGS): Use G_THREAD_CFLAGS for compiling of glib
as well.
* glib.h, gmutex.c: Changed private to private_key to avoid
problems when compiling with under C++.
1998-12-15 Jeff Garzik <jgarzik@Pobox.com> 1998-12-15 Jeff Garzik <jgarzik@Pobox.com>
* configure.in: * configure.in:

View File

@ -1,3 +1,14 @@
1998-12-15 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* configure.in: Dont complain, if --without-threads or
--with-threads=none is supplied; Test for pthread_attr_init
instead of pthread_cond_init, if threads seems to be supported by
standard glib. (CFLAGS): Use G_THREAD_CFLAGS for compiling of glib
as well.
* glib.h, gmutex.c: Changed private to private_key to avoid
problems when compiling with under C++.
1998-12-15 Jeff Garzik <jgarzik@Pobox.com> 1998-12-15 Jeff Garzik <jgarzik@Pobox.com>
* configure.in: * configure.in:

View File

@ -1,3 +1,14 @@
1998-12-15 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* configure.in: Dont complain, if --without-threads or
--with-threads=none is supplied; Test for pthread_attr_init
instead of pthread_cond_init, if threads seems to be supported by
standard glib. (CFLAGS): Use G_THREAD_CFLAGS for compiling of glib
as well.
* glib.h, gmutex.c: Changed private to private_key to avoid
problems when compiling with under C++.
1998-12-15 Jeff Garzik <jgarzik@Pobox.com> 1998-12-15 Jeff Garzik <jgarzik@Pobox.com>
* configure.in: * configure.in:

View File

@ -1,3 +1,14 @@
1998-12-15 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* configure.in: Dont complain, if --without-threads or
--with-threads=none is supplied; Test for pthread_attr_init
instead of pthread_cond_init, if threads seems to be supported by
standard glib. (CFLAGS): Use G_THREAD_CFLAGS for compiling of glib
as well.
* glib.h, gmutex.c: Changed private to private_key to avoid
problems when compiling with under C++.
1998-12-15 Jeff Garzik <jgarzik@Pobox.com> 1998-12-15 Jeff Garzik <jgarzik@Pobox.com>
* configure.in: * configure.in:

View File

@ -1,3 +1,14 @@
1998-12-15 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* configure.in: Dont complain, if --without-threads or
--with-threads=none is supplied; Test for pthread_attr_init
instead of pthread_cond_init, if threads seems to be supported by
standard glib. (CFLAGS): Use G_THREAD_CFLAGS for compiling of glib
as well.
* glib.h, gmutex.c: Changed private to private_key to avoid
problems when compiling with under C++.
1998-12-15 Jeff Garzik <jgarzik@Pobox.com> 1998-12-15 Jeff Garzik <jgarzik@Pobox.com>
* configure.in: * configure.in:

View File

@ -1,3 +1,14 @@
1998-12-15 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* configure.in: Dont complain, if --without-threads or
--with-threads=none is supplied; Test for pthread_attr_init
instead of pthread_cond_init, if threads seems to be supported by
standard glib. (CFLAGS): Use G_THREAD_CFLAGS for compiling of glib
as well.
* glib.h, gmutex.c: Changed private to private_key to avoid
problems when compiling with under C++.
1998-12-15 Jeff Garzik <jgarzik@Pobox.com> 1998-12-15 Jeff Garzik <jgarzik@Pobox.com>
* configure.in: * configure.in:

View File

@ -1,3 +1,14 @@
1998-12-15 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* configure.in: Dont complain, if --without-threads or
--with-threads=none is supplied; Test for pthread_attr_init
instead of pthread_cond_init, if threads seems to be supported by
standard glib. (CFLAGS): Use G_THREAD_CFLAGS for compiling of glib
as well.
* glib.h, gmutex.c: Changed private to private_key to avoid
problems when compiling with under C++.
1998-12-15 Jeff Garzik <jgarzik@Pobox.com> 1998-12-15 Jeff Garzik <jgarzik@Pobox.com>
* configure.in: * configure.in:

View File

@ -564,7 +564,10 @@ if test "x$want_threads" = xyes || test "x$want_threads" = xposix; then
AC_CHECK_LIB(pthreads, pthread_cond_init, have_threads=posix) AC_CHECK_LIB(pthreads, pthread_cond_init, have_threads=posix)
fi fi
if test "x$have_threads" = xnone; then if test "x$have_threads" = xnone; then
AC_CHECK_FUNC(pthread_cond_init, have_threads=posix) # dont let us be fooled by a defined pthread_cond_init
# function in the standard c-lib, that doesn't have too mean,
# there is full thread support, it might be a weak symbol.
AC_CHECK_FUNC(pthread_attr_init, have_threads=posix)
fi fi
fi fi
if test "x$want_threads" = xyes || test "x$want_threads" = xnspr; then if test "x$want_threads" = xyes || test "x$want_threads" = xnspr; then
@ -575,7 +578,7 @@ fi
AC_MSG_CHECKING(for thread implementation) AC_MSG_CHECKING(for thread implementation)
if test "x$have_threads" = xnone; then if test "x$have_threads" = xnone && test "x$want_threads" != xno; then
AC_MSG_RESULT(none available) AC_MSG_RESULT(none available)
AC_MSG_WARN($THREAD_NO_IMPLEMENTATION) AC_MSG_WARN($THREAD_NO_IMPLEMENTATION)
else else
@ -680,6 +683,8 @@ AC_DEFINE_UNQUOTED(G_THREAD_SOURCE,"gthread-$have_threads.c")
AC_SUBST(G_THREAD_CFLAGS) AC_SUBST(G_THREAD_CFLAGS)
AC_SUBST(G_THREAD_LIBS) AC_SUBST(G_THREAD_LIBS)
CFLAGS="$CFLAGS $G_THREAD_CFLAGS"
dnl ****************************** dnl ******************************
dnl *** output the whole stuff *** dnl *** output the whole stuff ***
dnl ****************************** dnl ******************************

18
glib.h
View File

@ -2620,8 +2620,8 @@ struct _GThreadFunctions
GTimeVal *end_time); GTimeVal *end_time);
void (*cond_free) (GCond* cond); void (*cond_free) (GCond* cond);
GPrivate* (*private_new) (GDestroyNotify destructor); GPrivate* (*private_new) (GDestroyNotify destructor);
gpointer (*private_get) (GPrivate* private); gpointer (*private_get) (GPrivate* private_key);
void (*private_set) (GPrivate* private, gpointer value); void (*private_set) (GPrivate* private_key, gpointer value);
}; };
GUTILS_C_VAR GThreadFunctions g_thread_functions_for_glib_use; GUTILS_C_VAR GThreadFunctions g_thread_functions_for_glib_use;
@ -2660,11 +2660,11 @@ GMutex* g_static_mutex_get_mutex_impl(GMutex** mutex);
#define g_private_new(destructor) \ #define g_private_new(destructor) \
G_USE_THREAD_FUNC_UNCOND(private_new,(destructor)) G_USE_THREAD_FUNC_UNCOND(private_new,(destructor))
#define g_private_get(private) \ #define g_private_get(private_key) \
G_USE_THREAD_FUNC(private_get,((gpointer)private),(private)) G_USE_THREAD_FUNC(private_get,((gpointer)private_key),(private_key))
#define g_private_set(private,value) \ #define g_private_set(private_key,value) \
G_USE_THREAD_FUNC(private_set,(void)(private=(GPrivate *)(value)), \ G_USE_THREAD_FUNC(private_set,(void)(private_key=(GPrivate *)(value)), \
(private,value)) (private_key,value))
/* GStaticMutex'es can be statically initialized with the value /* GStaticMutex'es can be statically initialized with the value
* G_STATIC_MUTEX_INIT, and then they can directly be used, that is * G_STATIC_MUTEX_INIT, and then they can directly be used, that is
@ -2684,8 +2684,8 @@ struct _GStaticPrivate
#define G_STATIC_PRIVATE_INIT { 0 } #define G_STATIC_PRIVATE_INIT { 0 }
gpointer g_static_private_get (GStaticPrivate* private); gpointer g_static_private_get (GStaticPrivate* private_key);
void g_static_private_set (GStaticPrivate *private, void g_static_private_set (GStaticPrivate *private_key,
gpointer data, gpointer data,
GDestroyNotify notify); GDestroyNotify notify);

View File

@ -2620,8 +2620,8 @@ struct _GThreadFunctions
GTimeVal *end_time); GTimeVal *end_time);
void (*cond_free) (GCond* cond); void (*cond_free) (GCond* cond);
GPrivate* (*private_new) (GDestroyNotify destructor); GPrivate* (*private_new) (GDestroyNotify destructor);
gpointer (*private_get) (GPrivate* private); gpointer (*private_get) (GPrivate* private_key);
void (*private_set) (GPrivate* private, gpointer value); void (*private_set) (GPrivate* private_key, gpointer value);
}; };
GUTILS_C_VAR GThreadFunctions g_thread_functions_for_glib_use; GUTILS_C_VAR GThreadFunctions g_thread_functions_for_glib_use;
@ -2660,11 +2660,11 @@ GMutex* g_static_mutex_get_mutex_impl(GMutex** mutex);
#define g_private_new(destructor) \ #define g_private_new(destructor) \
G_USE_THREAD_FUNC_UNCOND(private_new,(destructor)) G_USE_THREAD_FUNC_UNCOND(private_new,(destructor))
#define g_private_get(private) \ #define g_private_get(private_key) \
G_USE_THREAD_FUNC(private_get,((gpointer)private),(private)) G_USE_THREAD_FUNC(private_get,((gpointer)private_key),(private_key))
#define g_private_set(private,value) \ #define g_private_set(private_key,value) \
G_USE_THREAD_FUNC(private_set,(void)(private=(GPrivate *)(value)), \ G_USE_THREAD_FUNC(private_set,(void)(private_key=(GPrivate *)(value)), \
(private,value)) (private_key,value))
/* GStaticMutex'es can be statically initialized with the value /* GStaticMutex'es can be statically initialized with the value
* G_STATIC_MUTEX_INIT, and then they can directly be used, that is * G_STATIC_MUTEX_INIT, and then they can directly be used, that is
@ -2684,8 +2684,8 @@ struct _GStaticPrivate
#define G_STATIC_PRIVATE_INIT { 0 } #define G_STATIC_PRIVATE_INIT { 0 }
gpointer g_static_private_get (GStaticPrivate* private); gpointer g_static_private_get (GStaticPrivate* private_key);
void g_static_private_set (GStaticPrivate *private, void g_static_private_set (GStaticPrivate *private_key,
gpointer data, gpointer data,
GDestroyNotify notify); GDestroyNotify notify);

View File

@ -104,7 +104,7 @@ g_static_mutex_get_mutex_impl (GMutex** mutex)
} }
gpointer gpointer
g_static_private_get (GStaticPrivate *private) g_static_private_get (GStaticPrivate *private_key)
{ {
GArray *array; GArray *array;
@ -112,16 +112,16 @@ g_static_private_get (GStaticPrivate *private)
if (!array) if (!array)
return NULL; return NULL;
if (!private->index) if (!private_key->index)
return NULL; return NULL;
else if (private->index <= array->len) else if (private_key->index <= array->len)
return g_array_index (array, GStaticPrivateNode, (private->index - 1)).data; return g_array_index (array, GStaticPrivateNode, (private_key->index - 1)).data;
else else
return NULL; return NULL;
} }
void void
g_static_private_set (GStaticPrivate *private, g_static_private_set (GStaticPrivate *private_key,
gpointer data, gpointer data,
GDestroyNotify notify) GDestroyNotify notify)
{ {
@ -135,21 +135,21 @@ g_static_private_set (GStaticPrivate *private,
g_private_set (g_thread_specific_private, array); g_private_set (g_thread_specific_private, array);
} }
if (!private->index) if (!private_key->index)
{ {
g_mutex_lock (g_thread_specific_mutex); g_mutex_lock (g_thread_specific_mutex);
if (!private->index) if (!private_key->index)
private->index = ++next_index; private_key->index = ++next_index;
g_mutex_unlock (g_thread_specific_mutex); g_mutex_unlock (g_thread_specific_mutex);
} }
if (private->index > array->len) if (private_key->index > array->len)
g_array_set_size (array, private->index); g_array_set_size (array, private_key->index);
g_array_index (array, GStaticPrivateNode, (private->index - 1)).data = data; g_array_index (array, GStaticPrivateNode, (private_key->index - 1)).data = data;
g_array_index (array, GStaticPrivateNode, (private->index - 1)).destroy = notify; g_array_index (array, GStaticPrivateNode, (private_key->index - 1)).destroy = notify;
} }
static void static void