Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Suspending execution of a function

Status
Not open for further replies.

tewari68

Programmer
Jan 25, 2005
87
US
Hi,
I have a function to write to a database, however before writing to the database I want to check if the database server is available, if it is not available i would like to check the availability every minute for three minutes (3 tries to connect to the database), before giving up and producing an appropriate error message.
Can anybody give me a solution to the above problem.

Is there any function in C++ something like wait or stop which stops the execution of a particular function for a given time before retrying to execute the function.

Thanks,
tewari
 
Most platforms have a sleep or Sleep function that pauses program execution for a certain number of seconds or milliseconds. Check your library's documentation for sleep.
 
Hi uolj,
Thanks for the hint, that works.
Thanks,
tewari
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top