Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Stop large loop in run time?

Stop large loop in run time?

Scheduled Pinned Locked Moved C / C++ / MFC
question
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    closecall
    wrote on last edited by
    #1

    how do i stop a time consuming for loop in run time? (apart from using callbacks/multithreading) is there a brutal way to stop a loop like: for (int i=0; i<=10000000000000; i++) { j += i; } ideas ??? :confused:

    D A 2 Replies Last reply
    0
    • C closecall

      how do i stop a time consuming for loop in run time? (apart from using callbacks/multithreading) is there a brutal way to stop a loop like: for (int i=0; i<=10000000000000; i++) { j += i; } ideas ??? :confused:

      D Offline
      D Offline
      Dominik Reichl
      wrote on last edited by
      #2

      Something like this?: http://www.cpp-home.com/contests/tests.php[^] Dominik


      _outp(0x64, 0xAD); and __asm mov al, 0xAD __asm out 0x64, al do the same... but what do they do?? ;) (doesn't work on NT)

      1 Reply Last reply
      0
      • C closecall

        how do i stop a time consuming for loop in run time? (apart from using callbacks/multithreading) is there a brutal way to stop a loop like: for (int i=0; i<=10000000000000; i++) { j += i; } ideas ??? :confused:

        A Offline
        A Offline
        Alexander M
        wrote on last edited by
        #3

        make it like this:

        for (int i=0; i<=10000000000000; i++) {
        j += i;
        if( bStop )
        break;
        }
        ...
        void Stop()
        {
        bStop = TRUE;
        }

        AND: i is an integer number, so 10000000000000 IS INVALID for int!!! (too big) Don't try it, just do it! ;-)

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups