Thanks Jason for the reply. But why is this considered not safe. Could this be a little more elaborated ?
Regards Vinu -----Original Message----- From: Jason Evans [mailto:[EMAIL PROTECTED] Sent: Friday, October 08, 2004 9:37 PM To: [EMAIL PROTECTED] Subject: Re: Issue with pth_mutex_acquire. 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]
----------------------------------------------------------------------------------------------------------------------------- Disclaimer ----------------------------------------------------------------------------------------------------------------------------- "This message(including attachment if any)is confidential and may be privileged.Before opening attachments please check them for viruses and defects.MindTree Consulting Private Limited (MindTree)will not be responsible for any viruses or defects or any forwarded attachments emanating either from within MindTree or outside.If you have received this message by mistake please notify the sender by return e-mail and delete this message from your system. Any unauthorized use or dissemination of this message in whole or in part is strictly prohibited. Please note that e-mails are susceptible to change and MindTree shall not be liable for any improper, untimely or incomplete transmission." -----------------------------------------------------------------------------------------------------------------------------