Recursion and I do not get a long well. There are a lot of little reasons, but it is mostly because Recursion is much older than me and because of that difference in ages, we don’t have much in common. Like I hate referring to myself to answer a question I asked myself which I referred to myself to answer earlier, etc. That and it’s a Toronto Maple Leafs fan. I just know it is, anything that crazy has to be a Maple Leafs fan.
But really Recursion and I don’t get along because it only takes one time for you to fall for its cute laugh, nice smile and charming allure before…*BAM*, your system blue screens, and the resulting call stack is totally blown to the point it takes some funky debugging to figure out what in the name of Maurice Richard you did to make that nastyness happen.
The last time something like this happened it was because a piece of 1394 hardware kept storming a callback in my test driver, so I ended up having to put a cap on the number of times that particular callback routine could be invoked. As it turns out it was actually a bug in the firmware for the test device which, thankfully, the IHV fixed, but it is something I tend to look for when I write drivers. “Is this something that could be ‘attacked’ by external recusrion?” So here is Patrick’s 2nd law;
Every body perseveres in its state of being at rest or of moving uniformly straight forward, except insofar as it is compelled to change its state by force impressed.
An object that is in motion will not change its veolcity (accelerate) until a net force acts upon it.
Or in my little universe of weirdness;
A routine which is exposed externally can be called as many times on as many threads as decided by the caller.
Yes, that’s Newton’s first law, and yes, it holds a less direct relation to programming (especially Recursion) than my frist law, but it’s my blog, so 😛
So unlike Recursion, Interlocked APIs are my friends, Recursion is not. It’s an acquantance, somebody I would say “hi” to at a party, but I would never loan it money or drive it to the airport or babysit for.