× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Do you have the sigaction() set up properly? i.e. if you replaced takedescriptor() with sleep() (just for the sake of a test, mind you) would it successfully receive the alarm() signal? (Just to rule out a bug in your sigaction code...)

Assuming that the problem really is in takedescriptor() instead of something with your signal mask or signal configuration, then would you be open to alternatives?

For example, back in the V3 and V4 days when I still used takedescriptor(), I would always have my workers sitting on a data queue. I wouldn't call takedescriptor() until the data queue had an entry -- therefore the program would never block on takedescriptor(), because I would only call it when I knew there was a descriptor to take.

Alternately, you could eliminate takedescriptor (I know I haven't used it in 10 years) and use sendmsg() and recvmsg() instead. I'm confident that _they_ will be interrupted by a signal.

Or... depending on what you're doing... you might find spawn() to be a better choice. It handles the submit and the descriptor passing all in one fell swoop.

But... are you sure that alarm() doesn't interrupt takedescriptor?


On 10/8/2010 12:30 AM, Larry Ducie wrote:

Hi all,

We have some code that listens on a takedescriptor and want to put a timeout on it. If the timeout is reached then we'll can the job.

I tried:

alarm(seconds);

sd = takedescriptor(*null);

alarm(0);

But takedescriptor blocks!

The handler procedure set for alarm isn't called when the time runs out. Once the timeout has occurred nothing happens. If I pass a descriptor after this timeout period takedescriptor completes and the handler procedure is THEN called. So SIGALRM is being blocked by takedescriptor until it completes.

Any of you guys/gals have an alternative solution? I know other signals can not be blocked but I need a timer-based solution so a call to kill wont do it. Also, I can't replace takedescriptor with rcvmsg because other processes are using givedescriptor, not sndmsg.

Any and all help is welcome.

Cheers

Larry Ducie





As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.