Art W
Art W

Reputation: 2038

Custom Event Handler

I have a function that I'm using while(true) to repeatedly scan memory addresses of an application to detect change. I sleep the thread 1 second between iterations and this helps performance. However, is there a way to create a custom event handler to do away with the loops?

Upvotes: 2

Views: 412

Answers (1)

Aaron Daniels
Aaron Daniels

Reputation: 9664

Have you looked into using a Timer with an Interval of 1000 (milliseconds)?

This also gives you a clean way out of your polling by simply destroying the timer, instead of having to check some condition and breaking out of your while loop.

Upvotes: 2

Related Questions