Re: [PATCH] safe for when threading, related to gnome_show_url (was Re: request for help)
- From: Albrecht Dreß <albrecht dress arcormail de>
- To: Pawel Salek <pawsa TheoChem kth se>
- Cc: balsa mailing-list <balsa-list gnome org>
- Subject: Re: [PATCH] safe for when threading, related to gnome_show_url (was Re: request for help)
- Date: Tue, 21 Aug 2001 20:04:44 +0200
Am 21.08.2001 16:21:50 schrieb(en) Pawel Salek:
> I attach a preleminary patch that should take care of the hang when
> clicking on URLs. Please, give it a try if you have observe this
> problem.
For me (I don't have a smp machine, but compiled balsa with threads) this
patch freezes balsa when I try to open the second url in one session.
[snip]
> +static void
> +balsa_gnome_url_show(const gchar* url)
> +{
> + pthread_atfork(lock_all, unlock_all, unlock_all);
> + gnome_url_show(url);
> +}
IMHO, this is just the wrong approach. If I understand the man page of
pthread_atfork() correctly, then the handlers are *installed* by calling it,
but never removed. Calling it multiple times, all installed handlers ar called
in LIFO/FIFO order. So upon the second call of balsa_gnome_url_show(), all
handlers will be called twice...
To check this, I just added a simple debugging output (print __FILE__,
__FUNCTION__ and pid) to all involved functions:
[albrecht@regulus balsa-patched]$ src/balsa
Opening 5 mailboxes on startup.
balsa-message.c:balsa_gnome_url_show pid=7833 # <- clicked on 1st URL
balsa-message.c:lock_all pid=7833
balsa-message.c:unlock_all pid=7833
balsa-message.c:unlock_all pid=7843
balsa-message.c:lock_all pid=7843
balsa-message.c:unlock_all pid=7843
balsa-message.c:unlock_all pid=7844
balsa-message.c:balsa_gnome_url_show pid=7833 # <- clicked on 2nd URL
balsa-message.c:lock_all pid=7833
balsa-message.c:lock_all pid=7833
...and at this point it hangs.
I can't actually check if this resolves the smp problem, but apparently one
single call to pthread_atfork() seems to be sufficient. Maybe this should go
into main.c instead of balsa-message.c?
Cheers, Albrecht.
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Albrecht Dreß - Monschauer Straße 22 - D-53121 Bonn (Germany)
Phone (+49) 228 6199571 - mailto:albrecht.dress@arcormail.de
_________________________________________________________________________
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]