diff --git a/ChangeLog b/ChangeLog index ae3c29b61..7060a7a91 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2001-09-19 Sebastian Wilhelmi + + * glib/gthread.h (GThreadFunctions): Add thread_equal function to + allow for platform defined function to compare two threads. + + * glib/gthread.c: Use g_thread_functions_for_glib_use.thread_equal + when non-NULL instead of ==. + Wed Sep 19 10:44:25 2001 Tim Janik * Released 1.3.8. diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index ae3c29b61..7060a7a91 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,11 @@ +2001-09-19 Sebastian Wilhelmi + + * glib/gthread.h (GThreadFunctions): Add thread_equal function to + allow for platform defined function to compare two threads. + + * glib/gthread.c: Use g_thread_functions_for_glib_use.thread_equal + when non-NULL instead of ==. + Wed Sep 19 10:44:25 2001 Tim Janik * Released 1.3.8. diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index ae3c29b61..7060a7a91 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,11 @@ +2001-09-19 Sebastian Wilhelmi + + * glib/gthread.h (GThreadFunctions): Add thread_equal function to + allow for platform defined function to compare two threads. + + * glib/gthread.c: Use g_thread_functions_for_glib_use.thread_equal + when non-NULL instead of ==. + Wed Sep 19 10:44:25 2001 Tim Janik * Released 1.3.8. diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12 index ae3c29b61..7060a7a91 100644 --- a/ChangeLog.pre-2-12 +++ b/ChangeLog.pre-2-12 @@ -1,3 +1,11 @@ +2001-09-19 Sebastian Wilhelmi + + * glib/gthread.h (GThreadFunctions): Add thread_equal function to + allow for platform defined function to compare two threads. + + * glib/gthread.c: Use g_thread_functions_for_glib_use.thread_equal + when non-NULL instead of ==. + Wed Sep 19 10:44:25 2001 Tim Janik * Released 1.3.8. diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index ae3c29b61..7060a7a91 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,11 @@ +2001-09-19 Sebastian Wilhelmi + + * glib/gthread.h (GThreadFunctions): Add thread_equal function to + allow for platform defined function to compare two threads. + + * glib/gthread.c: Use g_thread_functions_for_glib_use.thread_equal + when non-NULL instead of ==. + Wed Sep 19 10:44:25 2001 Tim Janik * Released 1.3.8. diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index ae3c29b61..7060a7a91 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,11 @@ +2001-09-19 Sebastian Wilhelmi + + * glib/gthread.h (GThreadFunctions): Add thread_equal function to + allow for platform defined function to compare two threads. + + * glib/gthread.c: Use g_thread_functions_for_glib_use.thread_equal + when non-NULL instead of ==. + Wed Sep 19 10:44:25 2001 Tim Janik * Released 1.3.8. diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index ae3c29b61..7060a7a91 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,11 @@ +2001-09-19 Sebastian Wilhelmi + + * glib/gthread.h (GThreadFunctions): Add thread_equal function to + allow for platform defined function to compare two threads. + + * glib/gthread.c: Use g_thread_functions_for_glib_use.thread_equal + when non-NULL instead of ==. + Wed Sep 19 10:44:25 2001 Tim Janik * Released 1.3.8. diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index ae3c29b61..7060a7a91 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,11 @@ +2001-09-19 Sebastian Wilhelmi + + * glib/gthread.h (GThreadFunctions): Add thread_equal function to + allow for platform defined function to compare two threads. + + * glib/gthread.c: Use g_thread_functions_for_glib_use.thread_equal + when non-NULL instead of ==. + Wed Sep 19 10:44:25 2001 Tim Janik * Released 1.3.8. diff --git a/docs/reference/glib/tmpl/threads.sgml b/docs/reference/glib/tmpl/threads.sgml index 75bd49401..1b9d6143d 100644 --- a/docs/reference/glib/tmpl/threads.sgml +++ b/docs/reference/glib/tmpl/threads.sgml @@ -137,6 +137,7 @@ This struct should only be used, if you know, what you are doing. @thread_exit: @thread_set_priority: @thread_self: +@thread_equal: diff --git a/glib/gthread.c b/glib/gthread.c index 96cb3f456..1cd16fc05 100644 --- a/glib/gthread.c +++ b/glib/gthread.c @@ -49,17 +49,22 @@ #include #if GLIB_SIZEOF_SYSTEM_THREAD == SIZEOF_VOID_P -# define g_system_thread_equal(thread1, thread2) \ - (thread1.dummy_pointer == thread2.dummy_pointer) +# define g_system_thread_equal_simple(thread1, thread2) \ + ((thread1).dummy_pointer == (thread2).dummy_pointer) # define g_system_thread_assign(dest, src) \ - (dest.dummy_pointer = src.dummy_pointer) + ((dest).dummy_pointer = (src).dummy_pointer) #else /* GLIB_SIZEOF_SYSTEM_THREAD != SIZEOF_VOID_P */ -# define g_system_thread_equal(thread1, thread2) \ - (memcmp (&thread1, &thread2, GLIB_SIZEOF_SYSTEM_THREAD) == 0) +# define g_system_thread_equal_simple(thread1, thread2) \ + (memcmp (&(thread1), &(thread2), GLIB_SIZEOF_SYSTEM_THREAD) == 0) # define g_system_thread_assign(dest, src) \ - (memcpy (&dest, &src, GLIB_SIZEOF_SYSTEM_THREAD)) + (memcpy (&(dest), &(src), GLIB_SIZEOF_SYSTEM_THREAD)) #endif /* GLIB_SIZEOF_SYSTEM_THREAD == SIZEOF_VOID_P */ +#define g_system_thread_equal(thread1, thread2) \ + (g_thread_functions_for_glib_use.thread_equal ? \ + g_thread_functions_for_glib_use.thread_equal (&(thread1), &(thread2)) :\ + g_system_thread_equal_simple((thread1), (thread2))) + GQuark g_thread_error_quark (void) { diff --git a/glib/gthread.h b/glib/gthread.h index 215cc287a..d4573a1b8 100644 --- a/glib/gthread.h +++ b/glib/gthread.h @@ -102,6 +102,8 @@ struct _GThreadFunctions void (*thread_set_priority)(gpointer thread, GThreadPriority priority); void (*thread_self) (gpointer thread); + gboolean (*thread_equal) (gpointer thread1, + gpointer thread2); }; GLIB_VAR GThreadFunctions g_thread_functions_for_glib_use; diff --git a/gthread/ChangeLog b/gthread/ChangeLog index 77f953fb6..8159e1239 100644 --- a/gthread/ChangeLog +++ b/gthread/ChangeLog @@ -1,3 +1,11 @@ +2001-09-19 Sebastian Wilhelmi + + * gthread-posix.c: Add g_thread_equal_posix_impl and add to the + function vector g_thread_functions_for_glib_use_default. + + * gthread-solaris.c, gthread-win32.c: Add NULL as equal function, + as on those two platforms you don't need an equal function. + 2001-09-19 Tor Lillqvist * gthread.rc.in: Correct InternalName and OriginalFilename to diff --git a/gthread/gthread-posix.c b/gthread/gthread-posix.c index faeafbc8c..b65c9d57b 100644 --- a/gthread/gthread-posix.c +++ b/gthread/gthread-posix.c @@ -383,6 +383,12 @@ g_thread_self_posix_impl (gpointer thread) *(pthread_t*)thread = pthread_self(); } +static gboolean +g_thread_equal_posix_impl (gpointer thread1, gpointer thread2) +{ + return (pthread_equal (*(pthread_t*)thread1, *(pthread_t*)thread2) != 0); +} + static GThreadFunctions g_thread_functions_for_glib_use_default = { g_mutex_new_posix_impl, @@ -404,5 +410,6 @@ static GThreadFunctions g_thread_functions_for_glib_use_default = g_thread_join_posix_impl, g_thread_exit_posix_impl, g_thread_set_priority_posix_impl, - g_thread_self_posix_impl + g_thread_self_posix_impl, + g_thread_equal_posix_impl }; diff --git a/gthread/gthread-solaris.c b/gthread/gthread-solaris.c index 7eb7b8a36..8469b7200 100644 --- a/gthread/gthread-solaris.c +++ b/gthread/gthread-solaris.c @@ -270,5 +270,6 @@ static GThreadFunctions g_thread_functions_for_glib_use_default = g_thread_join_solaris_impl, g_thread_exit_solaris_impl, g_thread_set_priority_solaris_impl, - g_thread_self_solaris_impl + g_thread_self_solaris_impl, + NULL /* no equal function necessary on Solaris */ }; diff --git a/gthread/gthread-win32.c b/gthread/gthread-win32.c index aebe87d58..44e12a901 100644 --- a/gthread/gthread-win32.c +++ b/gthread/gthread-win32.c @@ -521,7 +521,8 @@ static GThreadFunctions g_thread_functions_for_glib_use_default = g_thread_join_win32_impl, g_thread_exit_win32_impl, g_thread_set_priority_win32_impl, - g_thread_self_win32_impl + g_thread_self_win32_impl, + NULL /* no equal function necessary */ }; #define HAVE_G_THREAD_IMPL_INIT