 |
makinha Level: Trainee
 Registered: 02-08-2006 Posts: 2
|
Is there a method in VB to set timeout on a function
Hello,
In VB.NET is there a function to keep track a function runtime, let say if I have a function called
func_may_hang(input_val) with return code integer
this function will return a positive return code when it completed, however if there is any error in between then it wait forever without any return code. Therefore, my following code will NOT work, as it keep waiting and no negative return code pass back.
If func_may_hang(FilePath) Then
statement 1
else
statement 2
end if
So, I wonder if VB.NET have any function to monitor a function runtime, and available to set timeout for the function, so that if it cannot complete within the time limit, then force to pass a negative return code? any idea?
like:
method.timeout = 5000 ' 5000 mil sec
If (method.run(func_may_hang(FilePath)) then
statement 1
else
statement 2
end if
Is it possible?? thanks.
|
|
26-10-2007 at 09:10 AM |
|
|
|
|
 |
 |