Max Execution Time on Thread

Collapse
This topic is closed.
X
X
  • Page of 1
  • Time
  • Show
Clear All
new posts
  • Dan Manges

    Max Execution Time on Thread

    How can I set the max execution time on a thread? I would like to throw
    an exception or indicate a failure if a thread runs longer than x seconds.

    Thanks,

    Dan Manges
    Tags: None
  • Peter Bromberg [C# MVP]

    #2
    RE: Max Execution Time on Thread

    Dan,
    You can use the WaitHandle.Wait One overload that takes a timespan /
    milliseconds parameter as a simplified thread / method execution timeout
    mechanism.



    --
    Co-founder, Eggheadcafe.com developer portal:

    UnBlog:





    "Dan Manges" wrote:
    [color=blue]
    > How can I set the max execution time on a thread? I would like to throw
    > an exception or indicate a failure if a thread runs longer than x seconds.
    >
    > Thanks,
    >
    > Dan Manges
    >[/color]

    Comment

  • Dan Manges

    #3
    Re: Max Execution Time on Thread

    Peter Bromberg [C# MVP] wrote:[color=blue]
    > Dan,
    > You can use the WaitHandle.Wait One overload that takes a timespan /
    > milliseconds parameter as a simplified thread / method execution timeout
    > mechanism.
    >
    > http://msdn2.microsoft.com/en-us/library/85bbbxt9.aspx
    >[/color]

    Peter,

    That worked perfectly. Thanks!

    Dan Manges

    Comment

Working...
👍
👎

AltStyle によって変換されたページ (->オリジナル) /