Stop code if timer tripped

Discussion created by cpicciri on Aug 4, 2011
Latest reply on Aug 4, 2011 by cpicciri
I have a program that processes 90,000+ records in an SDE feature class which determines the amount of overlap between a feature in this layer and another one and I need it to run as quickly as possible. I am using ITopologicalOperator2::Intersect to accomplish this and most of the times it runs very fast but on complicated polygons like road networks, the code chokes and takes a LONG time to get to the next feature. To speed things up, I am hoping to skip these troublesome polygons for now and deal with them later. What I am trying to do is everytime the code goes to the method with the ITopologicalOperator2 code in it, have it start a timer and if the timer reaches 30 seconds, stop the execution of the ITopologicalOperator operation, get out of the method and go on to the next feature. I have no idea if this can even be done and am hoping someone either knows how to do this or has a better idea to deal with the problem.

Thanks for your time,