Advertise on Bikeforums.net



User Tag List

Results 1 to 4 of 4
  1. #1
    One speed: FAST ! fordfasterr's Avatar
    Join Date
    Dec 2005
    Location
    Ft. Lauderdale FL
    My Bikes
    Ebay Bikes... =)
    Posts
    3,375
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    need a java while timer loop

    I need a java loop that will run for 2 minutes then stop.

    Anyone care to help with the code please?


    Thanks =)
    Florida Velodrome Association.
    Big Wheel Cycles.
    CAT-2. Road Bike: 2011 Specialized Allez SRAM Apex. .. and yes, I am vegan.

  2. #2
    Senior Member sshakari's Avatar
    Join Date
    Jul 2005
    Location
    Sherman Oaks, CA
    Posts
    436
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    maybe a sleep() for 2 minutes function will work better?

  3. #3
    One speed: FAST ! fordfasterr's Avatar
    Join Date
    Dec 2005
    Location
    Ft. Lauderdale FL
    My Bikes
    Ebay Bikes... =)
    Posts
    3,375
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by sshakari
    maybe a sleep() for 2 minutes function will work better?
    aah, don't think I can sleep it since the program spawns many other threads from within, if I use sleep(), it will effectively STOP the entire program...

    I simply want to RUN for 2 minutes and then stop =)
    Florida Velodrome Association.
    Big Wheel Cycles.
    CAT-2. Road Bike: 2011 Specialized Allez SRAM Apex. .. and yes, I am vegan.

  4. #4
    Senior Member thomson's Avatar
    Join Date
    Dec 2003
    Posts
    3,332
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by fordfasterr
    aah, don't think I can sleep it since the program spawns many other threads from within, if I use sleep(), it will effectively STOP the entire program...

    I simply want to RUN for 2 minutes and then stop =)
    In the absence of OS support of an external timer interrupt, the normal procedure is to launch a thread that does nothing but sleep. When sleep expires, post a bit accessible from the other threads. Those other threads check the bit as appropriate.

Posting Permissions

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