Professional Web Applications Themes

Timing - UNIX Programming

Hello, My code needs to calculate a value every half second for 40 seconds. I was considering using select as a fixed time value. Is it possible to use select like this with no FD associated with it? Is there a better method? Thanks, Richard...

  1. #1

    Default Timing

    Hello,

    My code needs to calculate a value every half second for 40 seconds. I
    was considering using select as a fixed time value. Is it possible to
    use select like this with no FD associated with it? Is there a better
    method?

    Thanks,
    Richard

    Richard Harris Guest

  2. #2

    Default Re: Timing


    "Richard Harris" <rharriskahuna.sdsu.edu> wrote in message
    news:3EF77D4C.1EAD3FABkahuna.sdsu.edu...
    > My code needs to calculate a value every half second for 40 seconds. I
    > was considering using select as a fixed time value. Is it possible to
    > use select like this with no FD associated with it? Is there a better
    > method?
    Yes, this is a perfectly reasonable way to use 'select'. You may find
    that 'usleep' or 'nanosleep' is a better option. Just be careful that you
    don't aculate error. Your .5 second sleep may well wind up sleeping for
    ..503 seconds (worse if the system is heavily loaded). If you take .02
    seconds to do the computation, after 40 seconds, you'll be running about a
    second late.

    You may prefer to use 'setitimer'. You could also use 'poll' just like
    'select', with no file descriptors.

    DS


    David Schwartz Guest

Similar Threads

  1. Timing out a FMS Session
    By Prema2909 in forum Macromedia Flash Flashcom
    Replies: 3
    Last Post: July 13th, 01:12 PM
  2. .Net and Flex timing
    By John Jackovin in forum Macromedia Flex General Discussion
    Replies: 0
    Last Post: February 18th, 04:58 PM
  3. strange timing
    By princefrog in forum Macromedia Flash Actionscript
    Replies: 0
    Last Post: February 11th, 03:27 AM
  4. Timing several processes
    By Anthony Akens in forum PERL Beginners
    Replies: 13
    Last Post: December 4th, 02:00 PM
  5. Timing a sql statement
    By Karthik Nagaraj in forum Microsoft SQL / MS SQL Server
    Replies: 2
    Last Post: July 11th, 02:07 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139