On Fri, Oct 08, 2004 at 09:27:57PM +0530, Vinu V wrote:
> 
> Hi,
>  
> I am having some problem in using linux signals with Pth threads.
>  
> This is what I have done
>  
> 1. From the main (), I have done a pth_init ().
> 2. Spawned two threads from the main(). These two threads just runs in a
> while loop with a small delay inside the while loop.
> 3. Registered a signal handler for SIGUSR1 signal from main(). I am using
> sigaction() system call for registering the signal handler.
> 4. main() does a pth_join() on the child thread ids.
>  
> Now from the signal handler for SIGUSR1 I am trying to acquire a mutex
> using the pth_mutex_acquire() call.
> Whenever the signal handler is executed, the program crashes at the
> pth_mutex_acquire() call.
>  
> Does anyone have any idea about why it is crashing while trying to acquire
> a mutex from a signal handler ?

What you can safely call in a signal handler is extremely limited.  Mutex
acquisition is definitely not on the list of safe APIs.

Jason
______________________________________________________________________
GNU Portable Threads (Pth)            http://www.gnu.org/software/pth/
Development Site                      http://www.ossp.org/pkg/lib/pth/
Distribution Files                          ftp://ftp.gnu.org/gnu/pth/
Distribution Snapshots                 ftp://ftp.ossp.org/pkg/lib/pth/
User Support Mailing List                            [EMAIL PROTECTED]
Automated List Manager (Majordomo)           [EMAIL PROTECTED]

Reply via email to