|
From: | Jan Djärv |
Subject: | Re: Lockup |
Date: | Thu, 10 Aug 2006 13:17:03 +0200 |
User-agent: | Thunderbird 1.5.0.5 (X11/20060808) |
YAMAMOTO Mitsuharu skrev:
On Thu, 10 Aug 2006 10:11:55 +0200, Jan Djärv <address@hidden> said:
In this particular case it would help, but in general the problem is that the signal handler gets called when the main thread is executing in the mutex code (pthread_mutex_unlock). Later when the signal handler tries to get the mutex, it locks up,My intention was that the above scenario would be avoided with BLOCK_INPUT around functions that may call malloc-related functions.
It does not help if the calling thread is one of the Gnoem threads.
How about just changing the order of lock/unlock and BLOCK_INPUT/UNBLOCK_INPUT in the previous version of BLOCK_INPUT_ALLOC/UNBLOCK_INPUT_ALLOC? #define BLOCK_INPUT_ALLOC \ do \ { \ if (pthread_self () == main_thread) \ BLOCK_INPUT; \ pthread_mutex_lock (&alloc_mutex); \ } \ while (0) #define UNBLOCK_INPUT_ALLOC \ do \ { \ pthread_mutex_unlock (&alloc_mutex); \ if (pthread_self () == main_thread) \ UNBLOCK_INPUT; \ } \ while (0)
That would mean that lock/unlock mutex functions are called in the signal handler context, which is not allowed according to the documentation.
Jan D.
[Prev in Thread] | Current Thread | [Next in Thread] |