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>
* 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>
* 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>
* 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>
* 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>
* 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>
* 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>
* 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>
* 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)
fi
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
if test "x$want_threads" = xyes || test "x$want_threads" = xnspr; then
@ -575,7 +578,7 @@ fi
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_WARN($THREAD_NO_IMPLEMENTATION)
else
@ -680,6 +683,8 @@ AC_DEFINE_UNQUOTED(G_THREAD_SOURCE,"gthread-$have_threads.c")
AC_SUBST(G_THREAD_CFLAGS)
AC_SUBST(G_THREAD_LIBS)
CFLAGS="$CFLAGS $G_THREAD_CFLAGS"
dnl ******************************
dnl *** output the whole stuff ***
dnl ******************************

18
glib.h
View File

@ -2620,8 +2620,8 @@ struct _GThreadFunctions
GTimeVal *end_time);
void (*cond_free) (GCond* cond);
GPrivate* (*private_new) (GDestroyNotify destructor);
gpointer (*private_get) (GPrivate* private);
void (*private_set) (GPrivate* private, gpointer value);
gpointer (*private_get) (GPrivate* private_key);
void (*private_set) (GPrivate* private_key, gpointer value);
};
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) \
G_USE_THREAD_FUNC_UNCOND(private_new,(destructor))
#define g_private_get(private) \
G_USE_THREAD_FUNC(private_get,((gpointer)private),(private))
#define g_private_set(private,value) \
G_USE_THREAD_FUNC(private_set,(void)(private=(GPrivate *)(value)), \
(private,value))
#define g_private_get(private_key) \
G_USE_THREAD_FUNC(private_get,((gpointer)private_key),(private_key))
#define g_private_set(private_key,value) \
G_USE_THREAD_FUNC(private_set,(void)(private_key=(GPrivate *)(value)), \
(private_key,value))
/* GStaticMutex'es can be statically initialized with the value
* 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 }
gpointer g_static_private_get (GStaticPrivate* private);
void g_static_private_set (GStaticPrivate *private,
gpointer g_static_private_get (GStaticPrivate* private_key);
void g_static_private_set (GStaticPrivate *private_key,
gpointer data,
GDestroyNotify notify);

View File

@ -2620,8 +2620,8 @@ struct _GThreadFunctions
GTimeVal *end_time);
void (*cond_free) (GCond* cond);
GPrivate* (*private_new) (GDestroyNotify destructor);
gpointer (*private_get) (GPrivate* private);
void (*private_set) (GPrivate* private, gpointer value);
gpointer (*private_get) (GPrivate* private_key);
void (*private_set) (GPrivate* private_key, gpointer value);
};
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) \
G_USE_THREAD_FUNC_UNCOND(private_new,(destructor))
#define g_private_get(private) \
G_USE_THREAD_FUNC(private_get,((gpointer)private),(private))
#define g_private_set(private,value) \
G_USE_THREAD_FUNC(private_set,(void)(private=(GPrivate *)(value)), \
(private,value))
#define g_private_get(private_key) \
G_USE_THREAD_FUNC(private_get,((gpointer)private_key),(private_key))
#define g_private_set(private_key,value) \
G_USE_THREAD_FUNC(private_set,(void)(private_key=(GPrivate *)(value)), \
(private_key,value))
/* GStaticMutex'es can be statically initialized with the value
* 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 }
gpointer g_static_private_get (GStaticPrivate* private);
void g_static_private_set (GStaticPrivate *private,
gpointer g_static_private_get (GStaticPrivate* private_key);
void g_static_private_set (GStaticPrivate *private_key,
gpointer data,
GDestroyNotify notify);

View File

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