Jump to content

Atomic Code


Lytus
 Share

Recommended Posts

The way you do it is the same in AutoIt as it is in any other program on Windows. If you want your thread/process to have higher priority, you have to increase the thread/process priority.

For those not familiar with the terminology, context switching is what occurs when the kernel switches from one thread to another. "Atomic code" would be code that would be guaranteed to run from start to end before a context switch is done.

Link to comment
Share on other sites

Thank you for the response, Valik.

I was hoping there was a code version of this in AutoIT rather than physically going to the task manager and increasing the process's priority, because I'd like a particular segment of the code to be atomic and not the whole program. If I would have to write my own C or C++ code to do this then it may be easier to just change the priority and adjust my program accordingly.

My apologies if some folks didn't understand what I meant in the question. Valik gave a great response. For anybody interested, you can read about it here: http://en.wikipedia.org/wiki/Context_switch. This is useful if you have an event-driven program, where the environment is changing (like a bot for a game GUI), and the program does the right thing 99% of the time and a seriously wrong thing 1% of the time. This occurs because your program could be finished processing the GUI and starting on your program's response, when a context switch happens and the game changes state. Your program will execute based on the erroneus game state, and the affects can range from not noticable to train wreck.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...