mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-09-27 17:52:58 +02:00
Renamed GLIB_SIZEOF_PTHREAD_T to GLIB_SIZEOF_SYSTEM_THREAD to reflect
1999-11-16 Sebastian Wilhelmi <wilhelmi@ira.uka.de> * acconfig.h, config.h.win32.in, configure.in: Renamed GLIB_SIZEOF_PTHREAD_T to GLIB_SIZEOF_SYSTEM_THREAD to reflect changed meaning. * configure.in: Cope with systems, that have a pthread_t type, that is not a pointer. Hint from Karl Nelson <kenelson@ece.ucdavis.edu>. Define GLIB_SIZEOF_SYSTEM_THREAD to 4 for Solaris. Cope with systems, that have no default mutex initialize, like obviously most DCE systems. * glib.h, gthread.c: Changed the prototype of thread_create and thread_self to return the system thread into provided memory instead of a return value. This is necessary, as HPUX has a pthread_t, that is bigger than the biggest integral type there. * gthread.c: system_thread is no longer a pointer, but an memory area of size GLIB_SIZEOF_SYSTEM_THREAD. Changed the zeroinitialization and the tests for zeroness accordingly.
This commit is contained in:
committed by
Sebastian Wilhelmi
parent
f0f028abd2
commit
760a7ceef2
21
ChangeLog
21
ChangeLog
@@ -1,3 +1,24 @@
|
|||||||
|
1999-11-16 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
||||||
|
|
||||||
|
* acconfig.h, config.h.win32.in, configure.in: Renamed
|
||||||
|
GLIB_SIZEOF_PTHREAD_T to GLIB_SIZEOF_SYSTEM_THREAD to reflect
|
||||||
|
changed meaning.
|
||||||
|
|
||||||
|
* configure.in: Cope with systems, that have a pthread_t type,
|
||||||
|
that is not a pointer. Hint from Karl Nelson
|
||||||
|
<kenelson@ece.ucdavis.edu>. Define GLIB_SIZEOF_SYSTEM_THREAD to 4
|
||||||
|
for Solaris. Cope with systems, that have no default mutex
|
||||||
|
initialize, like obviously most DCE systems.
|
||||||
|
|
||||||
|
* glib.h, gthread.c: Changed the prototype of thread_create and
|
||||||
|
thread_self to return the system thread into provided memory
|
||||||
|
instead of a return value. This is necessary, as HPUX has a
|
||||||
|
pthread_t, that is bigger than the biggest integral type there.
|
||||||
|
|
||||||
|
* gthread.c: system_thread is no longer a pointer, but an memory
|
||||||
|
area of size GLIB_SIZEOF_SYSTEM_THREAD. Changed the
|
||||||
|
zeroinitialization and the tests for zeroness accordingly.
|
||||||
|
|
||||||
1999-11-09 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
1999-11-09 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
||||||
|
|
||||||
* configure.in: Create docs/glib-config.1 from
|
* configure.in: Create docs/glib-config.1 from
|
||||||
|
@@ -1,3 +1,24 @@
|
|||||||
|
1999-11-16 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
||||||
|
|
||||||
|
* acconfig.h, config.h.win32.in, configure.in: Renamed
|
||||||
|
GLIB_SIZEOF_PTHREAD_T to GLIB_SIZEOF_SYSTEM_THREAD to reflect
|
||||||
|
changed meaning.
|
||||||
|
|
||||||
|
* configure.in: Cope with systems, that have a pthread_t type,
|
||||||
|
that is not a pointer. Hint from Karl Nelson
|
||||||
|
<kenelson@ece.ucdavis.edu>. Define GLIB_SIZEOF_SYSTEM_THREAD to 4
|
||||||
|
for Solaris. Cope with systems, that have no default mutex
|
||||||
|
initialize, like obviously most DCE systems.
|
||||||
|
|
||||||
|
* glib.h, gthread.c: Changed the prototype of thread_create and
|
||||||
|
thread_self to return the system thread into provided memory
|
||||||
|
instead of a return value. This is necessary, as HPUX has a
|
||||||
|
pthread_t, that is bigger than the biggest integral type there.
|
||||||
|
|
||||||
|
* gthread.c: system_thread is no longer a pointer, but an memory
|
||||||
|
area of size GLIB_SIZEOF_SYSTEM_THREAD. Changed the
|
||||||
|
zeroinitialization and the tests for zeroness accordingly.
|
||||||
|
|
||||||
1999-11-09 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
1999-11-09 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
||||||
|
|
||||||
* configure.in: Create docs/glib-config.1 from
|
* configure.in: Create docs/glib-config.1 from
|
||||||
|
@@ -1,3 +1,24 @@
|
|||||||
|
1999-11-16 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
||||||
|
|
||||||
|
* acconfig.h, config.h.win32.in, configure.in: Renamed
|
||||||
|
GLIB_SIZEOF_PTHREAD_T to GLIB_SIZEOF_SYSTEM_THREAD to reflect
|
||||||
|
changed meaning.
|
||||||
|
|
||||||
|
* configure.in: Cope with systems, that have a pthread_t type,
|
||||||
|
that is not a pointer. Hint from Karl Nelson
|
||||||
|
<kenelson@ece.ucdavis.edu>. Define GLIB_SIZEOF_SYSTEM_THREAD to 4
|
||||||
|
for Solaris. Cope with systems, that have no default mutex
|
||||||
|
initialize, like obviously most DCE systems.
|
||||||
|
|
||||||
|
* glib.h, gthread.c: Changed the prototype of thread_create and
|
||||||
|
thread_self to return the system thread into provided memory
|
||||||
|
instead of a return value. This is necessary, as HPUX has a
|
||||||
|
pthread_t, that is bigger than the biggest integral type there.
|
||||||
|
|
||||||
|
* gthread.c: system_thread is no longer a pointer, but an memory
|
||||||
|
area of size GLIB_SIZEOF_SYSTEM_THREAD. Changed the
|
||||||
|
zeroinitialization and the tests for zeroness accordingly.
|
||||||
|
|
||||||
1999-11-09 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
1999-11-09 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
||||||
|
|
||||||
* configure.in: Create docs/glib-config.1 from
|
* configure.in: Create docs/glib-config.1 from
|
||||||
|
@@ -1,3 +1,24 @@
|
|||||||
|
1999-11-16 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
||||||
|
|
||||||
|
* acconfig.h, config.h.win32.in, configure.in: Renamed
|
||||||
|
GLIB_SIZEOF_PTHREAD_T to GLIB_SIZEOF_SYSTEM_THREAD to reflect
|
||||||
|
changed meaning.
|
||||||
|
|
||||||
|
* configure.in: Cope with systems, that have a pthread_t type,
|
||||||
|
that is not a pointer. Hint from Karl Nelson
|
||||||
|
<kenelson@ece.ucdavis.edu>. Define GLIB_SIZEOF_SYSTEM_THREAD to 4
|
||||||
|
for Solaris. Cope with systems, that have no default mutex
|
||||||
|
initialize, like obviously most DCE systems.
|
||||||
|
|
||||||
|
* glib.h, gthread.c: Changed the prototype of thread_create and
|
||||||
|
thread_self to return the system thread into provided memory
|
||||||
|
instead of a return value. This is necessary, as HPUX has a
|
||||||
|
pthread_t, that is bigger than the biggest integral type there.
|
||||||
|
|
||||||
|
* gthread.c: system_thread is no longer a pointer, but an memory
|
||||||
|
area of size GLIB_SIZEOF_SYSTEM_THREAD. Changed the
|
||||||
|
zeroinitialization and the tests for zeroness accordingly.
|
||||||
|
|
||||||
1999-11-09 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
1999-11-09 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
||||||
|
|
||||||
* configure.in: Create docs/glib-config.1 from
|
* configure.in: Create docs/glib-config.1 from
|
||||||
|
@@ -1,3 +1,24 @@
|
|||||||
|
1999-11-16 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
||||||
|
|
||||||
|
* acconfig.h, config.h.win32.in, configure.in: Renamed
|
||||||
|
GLIB_SIZEOF_PTHREAD_T to GLIB_SIZEOF_SYSTEM_THREAD to reflect
|
||||||
|
changed meaning.
|
||||||
|
|
||||||
|
* configure.in: Cope with systems, that have a pthread_t type,
|
||||||
|
that is not a pointer. Hint from Karl Nelson
|
||||||
|
<kenelson@ece.ucdavis.edu>. Define GLIB_SIZEOF_SYSTEM_THREAD to 4
|
||||||
|
for Solaris. Cope with systems, that have no default mutex
|
||||||
|
initialize, like obviously most DCE systems.
|
||||||
|
|
||||||
|
* glib.h, gthread.c: Changed the prototype of thread_create and
|
||||||
|
thread_self to return the system thread into provided memory
|
||||||
|
instead of a return value. This is necessary, as HPUX has a
|
||||||
|
pthread_t, that is bigger than the biggest integral type there.
|
||||||
|
|
||||||
|
* gthread.c: system_thread is no longer a pointer, but an memory
|
||||||
|
area of size GLIB_SIZEOF_SYSTEM_THREAD. Changed the
|
||||||
|
zeroinitialization and the tests for zeroness accordingly.
|
||||||
|
|
||||||
1999-11-09 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
1999-11-09 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
||||||
|
|
||||||
* configure.in: Create docs/glib-config.1 from
|
* configure.in: Create docs/glib-config.1 from
|
||||||
|
@@ -1,3 +1,24 @@
|
|||||||
|
1999-11-16 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
||||||
|
|
||||||
|
* acconfig.h, config.h.win32.in, configure.in: Renamed
|
||||||
|
GLIB_SIZEOF_PTHREAD_T to GLIB_SIZEOF_SYSTEM_THREAD to reflect
|
||||||
|
changed meaning.
|
||||||
|
|
||||||
|
* configure.in: Cope with systems, that have a pthread_t type,
|
||||||
|
that is not a pointer. Hint from Karl Nelson
|
||||||
|
<kenelson@ece.ucdavis.edu>. Define GLIB_SIZEOF_SYSTEM_THREAD to 4
|
||||||
|
for Solaris. Cope with systems, that have no default mutex
|
||||||
|
initialize, like obviously most DCE systems.
|
||||||
|
|
||||||
|
* glib.h, gthread.c: Changed the prototype of thread_create and
|
||||||
|
thread_self to return the system thread into provided memory
|
||||||
|
instead of a return value. This is necessary, as HPUX has a
|
||||||
|
pthread_t, that is bigger than the biggest integral type there.
|
||||||
|
|
||||||
|
* gthread.c: system_thread is no longer a pointer, but an memory
|
||||||
|
area of size GLIB_SIZEOF_SYSTEM_THREAD. Changed the
|
||||||
|
zeroinitialization and the tests for zeroness accordingly.
|
||||||
|
|
||||||
1999-11-09 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
1999-11-09 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
||||||
|
|
||||||
* configure.in: Create docs/glib-config.1 from
|
* configure.in: Create docs/glib-config.1 from
|
||||||
|
@@ -1,3 +1,24 @@
|
|||||||
|
1999-11-16 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
||||||
|
|
||||||
|
* acconfig.h, config.h.win32.in, configure.in: Renamed
|
||||||
|
GLIB_SIZEOF_PTHREAD_T to GLIB_SIZEOF_SYSTEM_THREAD to reflect
|
||||||
|
changed meaning.
|
||||||
|
|
||||||
|
* configure.in: Cope with systems, that have a pthread_t type,
|
||||||
|
that is not a pointer. Hint from Karl Nelson
|
||||||
|
<kenelson@ece.ucdavis.edu>. Define GLIB_SIZEOF_SYSTEM_THREAD to 4
|
||||||
|
for Solaris. Cope with systems, that have no default mutex
|
||||||
|
initialize, like obviously most DCE systems.
|
||||||
|
|
||||||
|
* glib.h, gthread.c: Changed the prototype of thread_create and
|
||||||
|
thread_self to return the system thread into provided memory
|
||||||
|
instead of a return value. This is necessary, as HPUX has a
|
||||||
|
pthread_t, that is bigger than the biggest integral type there.
|
||||||
|
|
||||||
|
* gthread.c: system_thread is no longer a pointer, but an memory
|
||||||
|
area of size GLIB_SIZEOF_SYSTEM_THREAD. Changed the
|
||||||
|
zeroinitialization and the tests for zeroness accordingly.
|
||||||
|
|
||||||
1999-11-09 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
1999-11-09 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
||||||
|
|
||||||
* configure.in: Create docs/glib-config.1 from
|
* configure.in: Create docs/glib-config.1 from
|
||||||
|
@@ -1,3 +1,24 @@
|
|||||||
|
1999-11-16 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
||||||
|
|
||||||
|
* acconfig.h, config.h.win32.in, configure.in: Renamed
|
||||||
|
GLIB_SIZEOF_PTHREAD_T to GLIB_SIZEOF_SYSTEM_THREAD to reflect
|
||||||
|
changed meaning.
|
||||||
|
|
||||||
|
* configure.in: Cope with systems, that have a pthread_t type,
|
||||||
|
that is not a pointer. Hint from Karl Nelson
|
||||||
|
<kenelson@ece.ucdavis.edu>. Define GLIB_SIZEOF_SYSTEM_THREAD to 4
|
||||||
|
for Solaris. Cope with systems, that have no default mutex
|
||||||
|
initialize, like obviously most DCE systems.
|
||||||
|
|
||||||
|
* glib.h, gthread.c: Changed the prototype of thread_create and
|
||||||
|
thread_self to return the system thread into provided memory
|
||||||
|
instead of a return value. This is necessary, as HPUX has a
|
||||||
|
pthread_t, that is bigger than the biggest integral type there.
|
||||||
|
|
||||||
|
* gthread.c: system_thread is no longer a pointer, but an memory
|
||||||
|
area of size GLIB_SIZEOF_SYSTEM_THREAD. Changed the
|
||||||
|
zeroinitialization and the tests for zeroness accordingly.
|
||||||
|
|
||||||
1999-11-09 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
1999-11-09 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
||||||
|
|
||||||
* configure.in: Create docs/glib-config.1 from
|
* configure.in: Create docs/glib-config.1 from
|
||||||
|
@@ -45,9 +45,9 @@
|
|||||||
|
|
||||||
#undef GLIB_SIZEOF_GMUTEX
|
#undef GLIB_SIZEOF_GMUTEX
|
||||||
#undef GLIB_SIZEOF_INTMAX_T
|
#undef GLIB_SIZEOF_INTMAX_T
|
||||||
#undef GLIB_SIZEOF_PTHREAD_T
|
|
||||||
#undef GLIB_SIZEOF_PTRDIFF_T
|
#undef GLIB_SIZEOF_PTRDIFF_T
|
||||||
#undef GLIB_SIZEOF_SIZE_T
|
#undef GLIB_SIZEOF_SIZE_T
|
||||||
|
#undef GLIB_SIZEOF_SYSTEM_THREAD
|
||||||
|
|
||||||
#undef GLIB_BYTE_CONTENTS_GMUTEX
|
#undef GLIB_BYTE_CONTENTS_GMUTEX
|
||||||
#undef GLIB_BYTE_CONTENTS_GRECMUTEX
|
#undef GLIB_BYTE_CONTENTS_GRECMUTEX
|
||||||
|
@@ -60,7 +60,7 @@
|
|||||||
#define GLIB_INTERFACE_AGE @GLIB_INTERFACE_AGE@
|
#define GLIB_INTERFACE_AGE @GLIB_INTERFACE_AGE@
|
||||||
#define GLIB_BINARY_AGE @GLIB_BINARY_AGE@
|
#define GLIB_BINARY_AGE @GLIB_BINARY_AGE@
|
||||||
|
|
||||||
#define GLIB_SIZEOF_PTHREAD_T 4
|
#define GLIB_SIZEOF_SYSTEM_THREAD 4
|
||||||
#define GLIB_SIZEOF_SIZE_T 4
|
#define GLIB_SIZEOF_SIZE_T 4
|
||||||
#define GLIB_SIZEOF_PTRDIFF_T 4
|
#define GLIB_SIZEOF_PTRDIFF_T 4
|
||||||
#define GLIB_SIZEOF_INTMAX_T 4
|
#define GLIB_SIZEOF_INTMAX_T 4
|
||||||
|
16
configure.in
16
configure.in
@@ -736,7 +736,7 @@ case $have_threads in
|
|||||||
|
|
||||||
AC_MSG_CHECKING(for pthread_join$IN)
|
AC_MSG_CHECKING(for pthread_join$IN)
|
||||||
AC_TRY_LINK([#include <pthread.h>],
|
AC_TRY_LINK([#include <pthread.h>],
|
||||||
[pthread_join(NULL,NULL)],
|
[pthread_t t; pthread_join(t,NULL)],
|
||||||
[AC_MSG_RESULT(yes)
|
[AC_MSG_RESULT(yes)
|
||||||
G_THREAD_LIBS="$add_thread_lib"
|
G_THREAD_LIBS="$add_thread_lib"
|
||||||
break],
|
break],
|
||||||
@@ -876,12 +876,12 @@ if test x"$enable_threads" = xyes; then
|
|||||||
if test x"$have_threads" = xposix; then
|
if test x"$have_threads" = xposix; then
|
||||||
GLIB_SIZEOF([#include <pthread.h>],
|
GLIB_SIZEOF([#include <pthread.h>],
|
||||||
pthread_t,
|
pthread_t,
|
||||||
pthread_t)
|
system_thread)
|
||||||
# This is not AC_CHECK_FUNC to also work with function
|
# This is not AC_CHECK_FUNC to also work with function
|
||||||
# name mangling in header files.
|
# name mangling in header files.
|
||||||
AC_MSG_CHECKING(for pthread_attr_setstacksize)
|
AC_MSG_CHECKING(for pthread_attr_setstacksize)
|
||||||
AC_TRY_LINK([#include <pthread.h>],
|
AC_TRY_LINK([#include <pthread.h>],
|
||||||
[pthread_attr_setstacksize(NULL,0)],
|
[pthread_attr_t t; pthread_attr_setstacksize(&t,0)],
|
||||||
[AC_MSG_RESULT(yes)
|
[AC_MSG_RESULT(yes)
|
||||||
AC_DEFINE(HAVE_PTHREAD_ATTR_SETSTACKSIZE)],
|
AC_DEFINE(HAVE_PTHREAD_ATTR_SETSTACKSIZE)],
|
||||||
[AC_MSG_RESULT(no)])
|
[AC_MSG_RESULT(no)])
|
||||||
@@ -942,7 +942,12 @@ if test x"$enable_threads" = xyes; then
|
|||||||
posix_yield_func="$posix_yield_func()"
|
posix_yield_func="$posix_yield_func()"
|
||||||
fi
|
fi
|
||||||
AC_DEFINE_UNQUOTED(POSIX_YIELD_FUNC,$posix_yield_func)
|
AC_DEFINE_UNQUOTED(POSIX_YIELD_FUNC,$posix_yield_func)
|
||||||
|
else
|
||||||
|
# for now, the only other implementation is solaris
|
||||||
|
# -> there 4 bytes are enough
|
||||||
|
AC_DEFINE_UNQUOTED(GLIB_SIZEOF_SYSTEM_THREAD, 4)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
LIBS="$glib_save_LIBS"
|
LIBS="$glib_save_LIBS"
|
||||||
CFLAGS="$glib_save_CFLAGS"
|
CFLAGS="$glib_save_CFLAGS"
|
||||||
|
|
||||||
@@ -978,6 +983,9 @@ GLIB_IF_VAR_EQ(mutex_has_default, yes,
|
|||||||
gmutex,
|
gmutex,
|
||||||
$glib_cv_sizeof_gmutex,
|
$glib_cv_sizeof_gmutex,
|
||||||
$mutex_default_init)
|
$mutex_default_init)
|
||||||
|
if test x"$glib_cv_byte_contents_gmutex" = xno; then
|
||||||
|
mutex_has_default=no
|
||||||
|
fi
|
||||||
if test x"$have_threads" = xposix; then
|
if test x"$have_threads" = xposix; then
|
||||||
GLIB_BYTE_CONTENTS([#define __USE_GNU
|
GLIB_BYTE_CONTENTS([#define __USE_GNU
|
||||||
#include <$mutex_header_file>],
|
#include <$mutex_header_file>],
|
||||||
@@ -1182,7 +1190,7 @@ _______EOF
|
|||||||
# typedef GStaticMutex GStaticRecMutex to avoid silent
|
# typedef GStaticMutex GStaticRecMutex to avoid silent
|
||||||
# compilation, when a GStaticRecMutex is used where a
|
# compilation, when a GStaticRecMutex is used where a
|
||||||
# GStaticMutex should have been used and vice versa,
|
# GStaticMutex should have been used and vice versa,
|
||||||
# because that micht fail on other platforms.
|
# because that might fail on other platforms.
|
||||||
cat >>$outfile <<_______EOF
|
cat >>$outfile <<_______EOF
|
||||||
typedef struct _GStaticRecMutex GStaticRecMutex;
|
typedef struct _GStaticRecMutex GStaticRecMutex;
|
||||||
struct _GStaticRecMutex
|
struct _GStaticRecMutex
|
||||||
|
7
glib.h
7
glib.h
@@ -2934,18 +2934,19 @@ struct _GThreadFunctions
|
|||||||
gpointer (*private_get) (GPrivate *private_key);
|
gpointer (*private_get) (GPrivate *private_key);
|
||||||
void (*private_set) (GPrivate *private_key,
|
void (*private_set) (GPrivate *private_key,
|
||||||
gpointer data);
|
gpointer data);
|
||||||
gpointer (*thread_create) (GThreadFunc thread_func,
|
void (*thread_create) (GThreadFunc thread_func,
|
||||||
gpointer arg,
|
gpointer arg,
|
||||||
gulong stack_size,
|
gulong stack_size,
|
||||||
gboolean joinable,
|
gboolean joinable,
|
||||||
gboolean bound,
|
gboolean bound,
|
||||||
GThreadPriority priority);
|
GThreadPriority priority,
|
||||||
|
gpointer thread);
|
||||||
void (*thread_yield) (void);
|
void (*thread_yield) (void);
|
||||||
void (*thread_join) (gpointer thread);
|
void (*thread_join) (gpointer thread);
|
||||||
void (*thread_exit) (void);
|
void (*thread_exit) (void);
|
||||||
void (*thread_set_priority)(gpointer thread,
|
void (*thread_set_priority)(gpointer thread,
|
||||||
GThreadPriority priority);
|
GThreadPriority priority);
|
||||||
gpointer (*thread_self) (void);
|
void (*thread_self) (gpointer thread);
|
||||||
};
|
};
|
||||||
|
|
||||||
GUTILS_C_VAR GThreadFunctions g_thread_functions_for_glib_use;
|
GUTILS_C_VAR GThreadFunctions g_thread_functions_for_glib_use;
|
||||||
|
@@ -2934,18 +2934,19 @@ struct _GThreadFunctions
|
|||||||
gpointer (*private_get) (GPrivate *private_key);
|
gpointer (*private_get) (GPrivate *private_key);
|
||||||
void (*private_set) (GPrivate *private_key,
|
void (*private_set) (GPrivate *private_key,
|
||||||
gpointer data);
|
gpointer data);
|
||||||
gpointer (*thread_create) (GThreadFunc thread_func,
|
void (*thread_create) (GThreadFunc thread_func,
|
||||||
gpointer arg,
|
gpointer arg,
|
||||||
gulong stack_size,
|
gulong stack_size,
|
||||||
gboolean joinable,
|
gboolean joinable,
|
||||||
gboolean bound,
|
gboolean bound,
|
||||||
GThreadPriority priority);
|
GThreadPriority priority,
|
||||||
|
gpointer thread);
|
||||||
void (*thread_yield) (void);
|
void (*thread_yield) (void);
|
||||||
void (*thread_join) (gpointer thread);
|
void (*thread_join) (gpointer thread);
|
||||||
void (*thread_exit) (void);
|
void (*thread_exit) (void);
|
||||||
void (*thread_set_priority)(gpointer thread,
|
void (*thread_set_priority)(gpointer thread,
|
||||||
GThreadPriority priority);
|
GThreadPriority priority);
|
||||||
gpointer (*thread_self) (void);
|
void (*thread_self) (gpointer thread);
|
||||||
};
|
};
|
||||||
|
|
||||||
GUTILS_C_VAR GThreadFunctions g_thread_functions_for_glib_use;
|
GUTILS_C_VAR GThreadFunctions g_thread_functions_for_glib_use;
|
||||||
|
@@ -39,6 +39,24 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
typedef union _SystemThread SystemThread;
|
||||||
|
|
||||||
|
/* This represents a system thread as used by the implementation. An
|
||||||
|
* alien implementaion, as loaded by g_thread_init can only count on
|
||||||
|
* "sizeof (gpointer)" bytes to store their info. We however need more
|
||||||
|
* for some of our native implementations. */
|
||||||
|
union _SystemThread
|
||||||
|
{
|
||||||
|
guchar data[GLIB_SIZEOF_SYSTEM_THREAD];
|
||||||
|
gdouble double_dummy; /* These are used for the right alignment */
|
||||||
|
gpointer pointer_dummy;
|
||||||
|
#ifdef G_HAVE_GINT64
|
||||||
|
guint64 long_dummy;
|
||||||
|
#else
|
||||||
|
guint32 long_dummy;
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
typedef struct _GRealThread GRealThread;
|
typedef struct _GRealThread GRealThread;
|
||||||
|
|
||||||
struct _GRealThread
|
struct _GRealThread
|
||||||
@@ -46,10 +64,35 @@ struct _GRealThread
|
|||||||
GThread thread;
|
GThread thread;
|
||||||
GThreadFunc func;
|
GThreadFunc func;
|
||||||
gpointer arg;
|
gpointer arg;
|
||||||
gpointer system_thread;
|
|
||||||
gpointer private_data;
|
gpointer private_data;
|
||||||
|
SystemThread system_thread;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if (GLIB_SIZEOF_SYSTEM_THREAD <= 8 && defined(G_HAVE_GINT64)) \
|
||||||
|
|| (GLIB_SIZEOF_SYSTEM_THREAD <= 4)
|
||||||
|
/* We can use fast setting and checks */
|
||||||
|
# define set_system_thread_to_zero(t) (t->system_thread.long_dummy=0)
|
||||||
|
# define system_thread_is_not_zero(t) (t->system_thread.long_dummy)
|
||||||
|
#else
|
||||||
|
/* We have to do it the hard way and hope the compiler will optimize a bit */
|
||||||
|
static inline void
|
||||||
|
set_system_thread_to_zero(GRealThread* thread)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < GLIB_SIZEOF_SYSTEM_THREAD; i++)
|
||||||
|
thread->system_thread.data[i] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline gboolean
|
||||||
|
system_thread_is_not_zero(GRealThread* thread)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < GLIB_SIZEOF_SYSTEM_THREAD; i++)
|
||||||
|
if (thread->system_thread.data[i]) return FALSE;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef struct _GStaticPrivateNode GStaticPrivateNode;
|
typedef struct _GStaticPrivateNode GStaticPrivateNode;
|
||||||
|
|
||||||
struct _GStaticPrivateNode
|
struct _GStaticPrivateNode
|
||||||
@@ -84,9 +127,9 @@ GThreadFunctions g_thread_functions_for_glib_use = {
|
|||||||
(GPrivate*(*)(GDestroyNotify))g_thread_fail, /* private_new */
|
(GPrivate*(*)(GDestroyNotify))g_thread_fail, /* private_new */
|
||||||
NULL, /* private_get */
|
NULL, /* private_get */
|
||||||
NULL, /* private_set */
|
NULL, /* private_set */
|
||||||
(gpointer(*)(GThreadFunc, gpointer, gulong,
|
(void(*)(GThreadFunc, gpointer, gulong,
|
||||||
gboolean, gboolean,
|
gboolean, gboolean, GThreadPriority,
|
||||||
GThreadPriority))g_thread_fail, /* thread_create */
|
gpointer))g_thread_fail, /* thread_create */
|
||||||
NULL, /* thread_yield */
|
NULL, /* thread_yield */
|
||||||
NULL, /* thread_join */
|
NULL, /* thread_join */
|
||||||
NULL, /* thread_exit */
|
NULL, /* thread_exit */
|
||||||
@@ -298,7 +341,7 @@ g_thread_cleanup (gpointer data)
|
|||||||
if (!thread->thread.joinable)
|
if (!thread->thread.joinable)
|
||||||
{
|
{
|
||||||
/* Just to make sure, this isn't used any more */
|
/* Just to make sure, this isn't used any more */
|
||||||
thread->system_thread = NULL;
|
set_system_thread_to_zero(thread);
|
||||||
g_free (thread);
|
g_free (thread);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -347,10 +390,9 @@ g_thread_create (GThreadFunc thread_func,
|
|||||||
result->func = thread_func;
|
result->func = thread_func;
|
||||||
result->arg = arg;
|
result->arg = arg;
|
||||||
G_LOCK (g_thread_create);
|
G_LOCK (g_thread_create);
|
||||||
result->system_thread = G_THREAD_UF (thread_create, (g_thread_create_proxy,
|
G_THREAD_UF (thread_create, (g_thread_create_proxy, result, stack_size,
|
||||||
result, stack_size,
|
joinable, bound, priority,
|
||||||
joinable, bound,
|
&result->system_thread));
|
||||||
priority));
|
|
||||||
G_UNLOCK (g_thread_create);
|
G_UNLOCK (g_thread_create);
|
||||||
return (GThread*) result;
|
return (GThread*) result;
|
||||||
}
|
}
|
||||||
@@ -360,15 +402,16 @@ g_thread_join (GThread* thread)
|
|||||||
{
|
{
|
||||||
GRealThread* real = (GRealThread*) thread;
|
GRealThread* real = (GRealThread*) thread;
|
||||||
|
|
||||||
|
|
||||||
g_return_if_fail (thread);
|
g_return_if_fail (thread);
|
||||||
g_return_if_fail (thread->joinable);
|
g_return_if_fail (thread->joinable);
|
||||||
g_return_if_fail (real->system_thread);
|
g_return_if_fail (system_thread_is_not_zero (real));
|
||||||
|
|
||||||
G_THREAD_UF (thread_join, (real->system_thread));
|
G_THREAD_UF (thread_join, (&real->system_thread));
|
||||||
|
|
||||||
/* Just to make sure, this isn't used any more */
|
/* Just to make sure, this isn't used any more */
|
||||||
thread->joinable = 0;
|
thread->joinable = 0;
|
||||||
real->system_thread = NULL;
|
set_system_thread_to_zero (real);
|
||||||
|
|
||||||
/* the thread structure for non-joinable threads is freed upon
|
/* the thread structure for non-joinable threads is freed upon
|
||||||
thread end. We free the memory here. This will leave loose end,
|
thread end. We free the memory here. This will leave loose end,
|
||||||
@@ -384,10 +427,10 @@ g_thread_set_priority (GThread* thread,
|
|||||||
GRealThread* real = (GRealThread*) thread;
|
GRealThread* real = (GRealThread*) thread;
|
||||||
|
|
||||||
g_return_if_fail (thread);
|
g_return_if_fail (thread);
|
||||||
g_return_if_fail (real->system_thread);
|
g_return_if_fail (system_thread_is_not_zero (real));
|
||||||
|
|
||||||
thread->priority = priority;
|
thread->priority = priority;
|
||||||
G_THREAD_CF (thread_set_priority, (void)0, (real->system_thread, priority));
|
G_THREAD_CF (thread_set_priority, (void)0, (&real->system_thread, priority));
|
||||||
}
|
}
|
||||||
|
|
||||||
GThread*
|
GThread*
|
||||||
@@ -407,14 +450,14 @@ g_thread_self()
|
|||||||
just a guess */
|
just a guess */
|
||||||
thread->func = NULL;
|
thread->func = NULL;
|
||||||
thread->arg = NULL;
|
thread->arg = NULL;
|
||||||
thread->system_thread = NULL;
|
set_system_thread_to_zero (thread);
|
||||||
thread->private_data = NULL;
|
thread->private_data = NULL;
|
||||||
g_private_set (g_thread_specific_private, thread);
|
g_private_set (g_thread_specific_private, thread);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_thread_supported () && !thread->system_thread)
|
if (g_thread_supported () && !system_thread_is_not_zero(thread))
|
||||||
{
|
{
|
||||||
thread->system_thread = g_thread_functions_for_glib_use.thread_self();
|
g_thread_functions_for_glib_use.thread_self(&thread->system_thread);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (GThread*)thread;
|
return (GThread*)thread;
|
||||||
|
77
gthread.c
77
gthread.c
@@ -39,6 +39,24 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
typedef union _SystemThread SystemThread;
|
||||||
|
|
||||||
|
/* This represents a system thread as used by the implementation. An
|
||||||
|
* alien implementaion, as loaded by g_thread_init can only count on
|
||||||
|
* "sizeof (gpointer)" bytes to store their info. We however need more
|
||||||
|
* for some of our native implementations. */
|
||||||
|
union _SystemThread
|
||||||
|
{
|
||||||
|
guchar data[GLIB_SIZEOF_SYSTEM_THREAD];
|
||||||
|
gdouble double_dummy; /* These are used for the right alignment */
|
||||||
|
gpointer pointer_dummy;
|
||||||
|
#ifdef G_HAVE_GINT64
|
||||||
|
guint64 long_dummy;
|
||||||
|
#else
|
||||||
|
guint32 long_dummy;
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
typedef struct _GRealThread GRealThread;
|
typedef struct _GRealThread GRealThread;
|
||||||
|
|
||||||
struct _GRealThread
|
struct _GRealThread
|
||||||
@@ -46,10 +64,35 @@ struct _GRealThread
|
|||||||
GThread thread;
|
GThread thread;
|
||||||
GThreadFunc func;
|
GThreadFunc func;
|
||||||
gpointer arg;
|
gpointer arg;
|
||||||
gpointer system_thread;
|
|
||||||
gpointer private_data;
|
gpointer private_data;
|
||||||
|
SystemThread system_thread;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if (GLIB_SIZEOF_SYSTEM_THREAD <= 8 && defined(G_HAVE_GINT64)) \
|
||||||
|
|| (GLIB_SIZEOF_SYSTEM_THREAD <= 4)
|
||||||
|
/* We can use fast setting and checks */
|
||||||
|
# define set_system_thread_to_zero(t) (t->system_thread.long_dummy=0)
|
||||||
|
# define system_thread_is_not_zero(t) (t->system_thread.long_dummy)
|
||||||
|
#else
|
||||||
|
/* We have to do it the hard way and hope the compiler will optimize a bit */
|
||||||
|
static inline void
|
||||||
|
set_system_thread_to_zero(GRealThread* thread)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < GLIB_SIZEOF_SYSTEM_THREAD; i++)
|
||||||
|
thread->system_thread.data[i] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline gboolean
|
||||||
|
system_thread_is_not_zero(GRealThread* thread)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < GLIB_SIZEOF_SYSTEM_THREAD; i++)
|
||||||
|
if (thread->system_thread.data[i]) return FALSE;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef struct _GStaticPrivateNode GStaticPrivateNode;
|
typedef struct _GStaticPrivateNode GStaticPrivateNode;
|
||||||
|
|
||||||
struct _GStaticPrivateNode
|
struct _GStaticPrivateNode
|
||||||
@@ -84,9 +127,9 @@ GThreadFunctions g_thread_functions_for_glib_use = {
|
|||||||
(GPrivate*(*)(GDestroyNotify))g_thread_fail, /* private_new */
|
(GPrivate*(*)(GDestroyNotify))g_thread_fail, /* private_new */
|
||||||
NULL, /* private_get */
|
NULL, /* private_get */
|
||||||
NULL, /* private_set */
|
NULL, /* private_set */
|
||||||
(gpointer(*)(GThreadFunc, gpointer, gulong,
|
(void(*)(GThreadFunc, gpointer, gulong,
|
||||||
gboolean, gboolean,
|
gboolean, gboolean, GThreadPriority,
|
||||||
GThreadPriority))g_thread_fail, /* thread_create */
|
gpointer))g_thread_fail, /* thread_create */
|
||||||
NULL, /* thread_yield */
|
NULL, /* thread_yield */
|
||||||
NULL, /* thread_join */
|
NULL, /* thread_join */
|
||||||
NULL, /* thread_exit */
|
NULL, /* thread_exit */
|
||||||
@@ -298,7 +341,7 @@ g_thread_cleanup (gpointer data)
|
|||||||
if (!thread->thread.joinable)
|
if (!thread->thread.joinable)
|
||||||
{
|
{
|
||||||
/* Just to make sure, this isn't used any more */
|
/* Just to make sure, this isn't used any more */
|
||||||
thread->system_thread = NULL;
|
set_system_thread_to_zero(thread);
|
||||||
g_free (thread);
|
g_free (thread);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -347,10 +390,9 @@ g_thread_create (GThreadFunc thread_func,
|
|||||||
result->func = thread_func;
|
result->func = thread_func;
|
||||||
result->arg = arg;
|
result->arg = arg;
|
||||||
G_LOCK (g_thread_create);
|
G_LOCK (g_thread_create);
|
||||||
result->system_thread = G_THREAD_UF (thread_create, (g_thread_create_proxy,
|
G_THREAD_UF (thread_create, (g_thread_create_proxy, result, stack_size,
|
||||||
result, stack_size,
|
joinable, bound, priority,
|
||||||
joinable, bound,
|
&result->system_thread));
|
||||||
priority));
|
|
||||||
G_UNLOCK (g_thread_create);
|
G_UNLOCK (g_thread_create);
|
||||||
return (GThread*) result;
|
return (GThread*) result;
|
||||||
}
|
}
|
||||||
@@ -360,15 +402,16 @@ g_thread_join (GThread* thread)
|
|||||||
{
|
{
|
||||||
GRealThread* real = (GRealThread*) thread;
|
GRealThread* real = (GRealThread*) thread;
|
||||||
|
|
||||||
|
|
||||||
g_return_if_fail (thread);
|
g_return_if_fail (thread);
|
||||||
g_return_if_fail (thread->joinable);
|
g_return_if_fail (thread->joinable);
|
||||||
g_return_if_fail (real->system_thread);
|
g_return_if_fail (system_thread_is_not_zero (real));
|
||||||
|
|
||||||
G_THREAD_UF (thread_join, (real->system_thread));
|
G_THREAD_UF (thread_join, (&real->system_thread));
|
||||||
|
|
||||||
/* Just to make sure, this isn't used any more */
|
/* Just to make sure, this isn't used any more */
|
||||||
thread->joinable = 0;
|
thread->joinable = 0;
|
||||||
real->system_thread = NULL;
|
set_system_thread_to_zero (real);
|
||||||
|
|
||||||
/* the thread structure for non-joinable threads is freed upon
|
/* the thread structure for non-joinable threads is freed upon
|
||||||
thread end. We free the memory here. This will leave loose end,
|
thread end. We free the memory here. This will leave loose end,
|
||||||
@@ -384,10 +427,10 @@ g_thread_set_priority (GThread* thread,
|
|||||||
GRealThread* real = (GRealThread*) thread;
|
GRealThread* real = (GRealThread*) thread;
|
||||||
|
|
||||||
g_return_if_fail (thread);
|
g_return_if_fail (thread);
|
||||||
g_return_if_fail (real->system_thread);
|
g_return_if_fail (system_thread_is_not_zero (real));
|
||||||
|
|
||||||
thread->priority = priority;
|
thread->priority = priority;
|
||||||
G_THREAD_CF (thread_set_priority, (void)0, (real->system_thread, priority));
|
G_THREAD_CF (thread_set_priority, (void)0, (&real->system_thread, priority));
|
||||||
}
|
}
|
||||||
|
|
||||||
GThread*
|
GThread*
|
||||||
@@ -407,14 +450,14 @@ g_thread_self()
|
|||||||
just a guess */
|
just a guess */
|
||||||
thread->func = NULL;
|
thread->func = NULL;
|
||||||
thread->arg = NULL;
|
thread->arg = NULL;
|
||||||
thread->system_thread = NULL;
|
set_system_thread_to_zero (thread);
|
||||||
thread->private_data = NULL;
|
thread->private_data = NULL;
|
||||||
g_private_set (g_thread_specific_private, thread);
|
g_private_set (g_thread_specific_private, thread);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_thread_supported () && !thread->system_thread)
|
if (g_thread_supported () && !system_thread_is_not_zero(thread))
|
||||||
{
|
{
|
||||||
thread->system_thread = g_thread_functions_for_glib_use.thread_self();
|
g_thread_functions_for_glib_use.thread_self(&thread->system_thread);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (GThread*)thread;
|
return (GThread*)thread;
|
||||||
|
Reference in New Issue
Block a user