delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/06/24/19:04:00

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Message-Id: <200206241107.RAA08083@sentry-lan.unibase.com>
To: cygwin AT cygwin DOT com
Subject: Signals... SIGALRM
From: Milton Calnek <milton AT calnek DOT com>
Date: Mon, 24 Jun 2002 17:07:27 +0600

Hello all.

I'm trying to write a UDP server program I would like to poll for UDP input 
and periodically interupt the waiting to check the database.  My primary 
test environment is Cygwin.

I'm having trouble with SIGALRM not being sent/received.  Specifically,
I want to read UDP packets but I don't want to be blocked waiting for 
them.  I am using IO::Socket.

I took this from the Perl Cookbook

	if( eval {
		local $SIG{ALRM} = \&poll_db;
		alarm $config{TIMEOUT};
		print STDERR "poll_udp(): Wait for input\n";
		$sock->recv($input, $config{MAXLEN}) or die "poll_udp(): recv: $!";
		alarm 0;
		1;  # return value from eval on normalcy
	} ) {

and made a few modifications to it... it's from the udpmsg program 17.4 & 17.5

I read in the FAQ that not all signals are implemented... is SIGALRM one of those?
Is there a better way to do this?

Any help is apreciated.
TIA.

 
--
Milton Calnek
milton AT calnek DOT com

Everything should be as simple as possible - but no simpler. 
-- Albert Einstein as quoted by Peter G. Neumann in CHATS Principles 


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019