Pulse Counting and other stuff

Been playing around with the Pulse Count module https://www.ghielectronics.com/catalog/product/465 and it has some nice features like an interrupt where I can easily add in an safety limit switch for example, but I’m looking to squeeze everything I can out of it, both in terms of features and performance. So from the attached pic I have a simple DC motor and encoder connected to a Pulse Count module and I want the motor to stop at pulse X. Currently I’m using threading with AutoResetEvent and it seems pretty good but I’m never satisfied and want better, any suggestions as to what to try next?

Anyone using a pulse count type setup where you can set an interrupt to occur at pulse count X as it seems to be that would be the preferred way to do this, ie let the smarts on the module be dedicated to the problem of counting and alerting via interrupt.

Thanks