🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: es.comp.os.linux.programacion
Article #15884

Re: Funcion setitimer

#15884
From: J.A. Gutierrez
Date: Mon, 29 May 2000 00:00
40 lines
1664 bytes
"Jordi Fern�ndez" <sarabia@larural.es> wrote:
: �Alguien tiene por ahi un ejemplo de como se usa la funcion setitimer?

: Gracias.

#include	<sys/time.h>
#include	<signal.h>
#include	<unistd.h>
#include	<stdio.h>


void handler(int sig)
{
	printf("signal %d\n",sig);
}

int main(int argc, char *argv[] )
{
	static struct itimerval ivalue;
	static struct itimerval ovalue;

	sigset(SIGALRM,handler);

	ivalue.it_value.tv_usec = 900;
	ivalue.it_value.tv_sec = 0;

	ivalue.it_interval.tv_usec = 0;
	ivalue.it_interval.tv_sec = 3;

	setitimer(ITIMER_REAL, &ivalue, &ovalue);

	while(1)
		sleep(1024);
}

-- 
PGP and other useless info at      \                 Oh, show us the way
http://www.cps.unizar.es/~spd/      \             to the next whisky bar
finger://daphne.cps.unizar.es/spd    \                      Weill/Bretch
es doloroso ser sabio y descubrir la sopa de ajo                   (Pla)
Technical Details
Message-ID: <8gtr49$aqb$1@news.unizar.es>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <8gr203$fu0$1@talia.mad.ttd.net>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: f86c8,952a397ca4908678
X-Google-Attributes: gidf86c8,public
From: "J.A. Gutierrez" <spd@daphne.cps.unizar.es>
Subject: Re: Funcion setitimer
Date: 2000/05/29
Message-ID: <8gtr49$aqb$1@news.unizar.es>
X-Deja-AN: 628596327
Content-Transfer-Encoding: 8bit
References: <8gr203$fu0$1@talia.mad.ttd.net>
Content-Type: text/plain; charset=ISO-8859-1
X-Complaints-To: usenet@news.unizar.es
X-Trace: news.unizar.es 959606729 11083 155.210.152.20 (29 May 2000 13:25:29 GMT)
Organization: Rank
Mime-Version: 1.0
User-Agent: tin/1.4.1-19991201 ("Polish") (UNIX) (IRIX/6.2 (IP22))
NNTP-Posting-Date: 29 May 2000 13:25:29 GMT
Newsgroups: es.comp.os.linux.programacion