Possible Duplicate:
How to timeout a thread
I am using a function call to make a recursive search in a tree. It sets the best answer in a class variable and the function itself doesn't return anything.
So I want to limit the allowed time for the function. If the time has run out it simply stops and the thread is destroyed. How should I do if I want to limit the call to two seconds:
runFunction(search(),2000);