GNOME Bugzilla – Bug 104718
pthread fix for NetBSD-1.6M
Last modified: 2004-12-22 21:47:04 UTC
The NetBSD package for glib2 had a patch added with the following comment: Check for symbol "_POSIX_THREAD_PRIORITY_SCHEDULING" to detect existance of pthread_attr_getschedparam() and pthread_attr_setschedparam() as suggested by Nathan J. Williams. I'll attach the patch to the bug report, if I manage to. It is needed to get glib2 to compile&work on NetBSD-1.6M.
Created attachment 13911 [details] [review] patch to fix the problem
What happens without this change? It's not apparent from the patch why it would be needed.
Without this change, libgthread contained references to the (non-existing) functions pthread_attr_setschedparam() and pthread_attr_getschedparam().
I'd prefer the following patch. Would you mind testing it for NetBSD?
Created attachment 13951 [details] [review] patch to _really_ solve the problem
Does not fix the problem, results in exactly the same error.
Hm, but if that works, it means, that pthread_attr_setschedparam is available. Can you attach config.log
The suggested fix checks for pthread_attr_setschedparam() while the code in "gthread-posix.c" uses pthread_setschedparam(). Maybe that is the real problem.
Ok, gthread-posix.c uses both pthread_attr_setschedparam() and pthread_setschedparam(). Obviously pthread_attr_setschedparam() is defined in NetBSD, otherwise the configure check would fail. So what exactly is the error, when compiling stock GLib on NetBBSD. Which symbols are unresolved?
Please reopen from NEEDINFO if you add more information.
I don't see a configure test for pthread_attr_setschedparam: ``grep pthread_attr_setschedparam configure'' is empty. Without the patch, compilation works, but spews warnings: In file included from gthread-impl.c:45: gthread-posix.c: In function `g_thread_impl_init': gthread-posix.c:135: warning: implicit declaration of function `pthread_getschedparam' gthread-posix.c: In function `g_thread_set_priority_posix_impl': gthread-posix.c:391: warning: implicit declaration of function `pthread_setschedparam' gthread-impl.c: At top level: gthread-posix.c:118: warning: `g_thread_min_stack_size' defined but not used make test fails, with: creating list-test cc ........ ../gthread/.libs/libgthread-2.0.so: undefined reference to `pthread_getschedparam' ../gthread/.libs/libgthread-2.0.so: undefined reference to `pthread_setschedparam' What else do you want to know?
Then the following patch should fix it. Please try.
Created attachment 16851 [details] [review] Another try
I think you can go ahead and commit this, even though it would be good to have comfirmation that it fixes the problem. It looks pretty safe to me.
Patch works for me and Matthias Scheler.
2003-06-03 Sebastian Wilhelmi <seppi@seppi.de> * configure.in: Test for pthread_setschedparam. If not existant, disable priorities. (#104718) Only commited to HEAD. Reopen, if you think, glib-2-2 should have it too.
I'd appreciate it if the fix could be included on the 2.2 branch too. Thanks!
I'd agree that it's the kind of fix that should go into the stable branch.
Done.