GNOME Bugzilla – Bug 172813
Not thread safe usage of gnutls.
Last modified: 2005-04-10 18:45:23 UTC
Distribution/Version: Ubuntu In function _gnome_vfs_ssl_init calls gnutls_global_init. But for thread-enabled programs there must previous call like gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread) for set mutex lock/unlock callbacks.
Created attachment 39749 [details] [review] Patch. Proposed patch.
I'm not sure at all gnome-vfs can assume it's being run on a system with pthread available, iirc it uses gthread as a thread abstraction. So it would be better to provide custom locking functions as described on http://www.gnu.org/software/gnutls/manual/html_node/Multi_002dthreaded-applications.html (I guess you know that url, putting it there for other people reading this bug report ;) Dunno if that's doable though ;)
Created attachment 39752 [details] [review] New version of patch. Now with help of gthread. But it is my first usage of GThread. And it does not contains any error handling 'cause I didn't find how to handle it in GThread.
What kind of error handling is needed?
Hmm... I just don't know what kind of errors can return GThread calls. For example if g_mutex_new failed how he report it? Just returns null pointer or what?
Haven't looked at the source, but this is what most glib functions do, so I guess g_mutex_new will do that too.
Ok, that means that my patch is correct :)
Commit a version with small changes of this patch to cvs HEAD. Thanks for the patch! :)