how to catch timeout exception

lindacao
lindacao used Ask the Experts™
on
I wnat to catch a timeout exception in c++. Who can give me some ideas about how to do it? I need to call one function and if there is no response for 1 minute, I will print out time out error msg.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

  Create a thread.
  Start the Thread get the ID.
  use WaitForSingleObject ( .. ID , 60000 );

  If the thread has not finsihed within a minute WaitForSingleObject will return with .. TIMEOUT

  No need for an Exception in this case.

  (I'm assuming Windows)

Commented:
This question didn't show any activity for more than 21 days. I will ask Community Support to close it unless you finalize it yourself within 7 days.
You can always request to keep this question open. But remember, experts can only help if you provide feedback to their comments.
Unless there is objection or further activity,  I will suggest to accept

    "williamcampell"

comment(s) as an answer.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
========
Werner
Force accepted

** Mindphaser - Community Support Moderator **

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial