delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1999/08/11/22:27:50

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT sourceware DOT cygnus DOT com>
List-Archive: <http://sourceware.cygnus.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sourceware DOT cygnus DOT com>
List-Help: <mailto:cygwin-help AT sourceware DOT cygnus DOT com>,
<http://sourceware.cygnus.com/ml/#faqs>
Sender: cygwin-owner AT sourceware DOT cygnus DOT com
Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com
To: cygwin AT sourceware DOT cygnus DOT com
Cc: chikayama AT klic DOT org
Subject: B20.1: Setitimer provides virtual timer?
From: chikayama AT klic DOT org
X-Mailer: Mew version 1.92.4 on Emacs 19.34 / Mule 2.3 (SUETSUMUHANA)
Mime-Version: 1.0
Message-Id: <19990812112810X.chik@klic.org>
Date: Thu, 12 Aug 1999 11:28:10 +0900
X-Dispatcher: imput version 990310(IM110)
Lines: 47

"setitimer(ITIMER_VIRTUAL, ...)" does not seem to deliver SIGVTALRM
signals.  The test program included below, that sets the process timer
and loops awaiting for timer expiration, will loop forever.  However,
running this in background and sending the signal by "kill -VTALRM ..."
from the shell will terminate it as expected (with an exclamation mark 
output).

Is this the spec. of the current release or a bug?

# I really enjoy using Cygwin.  Thank you for your efforts!

-- Takashi Chikayama AT Dept. of Frontier Informatics., the Univ. of Tokyo
-- Tel. +81-3-5841-6658; Fax. +81-3-5841-8572
-- E-mail chikayama AT klic DOT org; Home page http://www.logos.t.u-tokyo.ac.jp

#include <sys/time.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>

volatile int time_has_come;

void handler(int signal)
{
  time_has_come = 1;
  fprintf(stderr, "!\n");
  return;
}

struct itimerval interval;

int main(int argc, char * const argv[])
{
  interval.it_interval.tv_sec = 0;
  interval.it_interval.tv_usec = 0;
  interval.it_value.tv_sec = 1;
  interval.it_value.tv_usec = 0;
  signal(SIGVTALRM, handler);
  (void) setitimer(ITIMER_VIRTUAL, &interval, NULL);
  time_has_come = 0;
  while (1) {
    if (time_has_come) {
      exit(0);
    }
  }
}

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com

- Raw text -


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