Thread: precise alarm()

  1. #1
    Registered User
    Join Date
    Oct 2004
    Posts
    15

    precise alarm()

    Is there a way to create an alarm to be precise by a milisecond. Currently I used alarm(), together with the SIGALRM signal but that's too slow. I then tried with gettimeofday() but the cpu had overhead, using all 100%.

    So is there a way to have something like ualarm() ?

    Greets,
    Luka

  2. #2
    Gawking at stupidity
    Join Date
    Jul 2004
    Location
    Oregon, USA
    Posts
    3,218
    So is there a way to have something like ualarm() ?
    Did you try? http://www.die.net/doc/linux/man/man3/ualarm.3.html
    If you understand what you're doing, you're not learning anything.

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    > Is there a way to create an alarm to be precise by a milisecond
    Depends on your definition of precise.
    All desktop operating systems only specify minimum time for all delays of this kind because there is no way to be precise with all the different sources of interrupts, and the interactions of other tasks in the system.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  4. #4
    Registered User
    Join Date
    Oct 2004
    Posts
    15
    itsme86: thanx that should do.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. clarification: behavior of type_info::before
    By Sebastiani in forum C++ Programming
    Replies: 11
    Last Post: 04-04-2008, 06:53 PM
  2. Alarm
    By kky2k in forum C Programming
    Replies: 10
    Last Post: 05-29-2007, 11:58 PM
  3. 2-3 Second delay with alarm()
    By Longie in forum C Programming
    Replies: 11
    Last Post: 06-20-2004, 08:46 PM
  4. Replies: 23
    Last Post: 01-31-2003, 03:13 AM
  5. ANN: The Fourth Contest: Alarm Clock, sign up here
    By ygfperson in forum A Brief History of Cprogramming.com
    Replies: 59
    Last Post: 08-10-2002, 12:24 AM