Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8453937
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T11:53:39+00:00 2026-06-10T11:53:39+00:00

I have registered my application for ARR . Assume that my application has a

  • 0

I have registered my application for ARR. Assume that my application has a IdTCPServer which reads data from the serial port using VSPE and adds it to a ClientDataSet. If the main thread freezes, ARR will call my ApplicationRecoveryCallback(). Can I access the IdTCPServer in the recovery callback function safely? I want it to stop so that I can save my ClientDataSet to the disk before restarting. Can I simply write my function this way?

function RecoveryFunction(pvParameter: Pointer): DWORD; stdcall;
var
  ContinueRecovery: Boolean;
begin
  Result := 0; // happy compiler ;-)
  repeat
    ApplicationRecoveryInProgress(ContinueRecovery);
    if not ContinueRecovery then
      ApplicationRecoveryFinished(False);
  until frmInstrument.CriticalSection.TryEnter;
  frmInstrument.IdTCPServer.Active := False;
  frmInstrument.CDS.SaveToFile(RecoveryFile);
  ApplicationRecoveryFinished(True);
end;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T11:53:40+00:00Added an answer on June 10, 2026 at 11:53 am

    I wouldn’t write it like that. This function is called when your program has stopped responding. For all you know, it’s stopped responding because something else is already stuck waiting for that same critical section.

    If you want to be able to access your data even when your program is hung, then you need a lock-free way of detecting when you’re allowed to read your data. Use a transaction-log model. Atomically update something that indicates how much of your data is valid. When you enter the recovery function, read that value, and save as much as it says is available. Don’t bother reading beyond that point because you can’t be certain that it’s not corrupt and the reason for your program’s crash in the first place.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have developed a android application using phonegap. I have registered certain recievers which
I have set up an app that is registered for remote notifications. - (void)application:(UIApplication*)application
I am using asp.net 3.5 with C#. I have registered my application in google
I have an <mx:Application> which contains a <mx:Module> . This module has several child
I am developing an application which posts videos to Facebook. I have registered this
I have a common GWT application that is using (trying to) Rocket-Framework to implement
I have registered my web application for use with oath2 using the following instructions:
If I have an application with only a few event handlers registered (and the
An application I have recently started work on has to register two dll's, because
I have a freelance web application that lets users register for events. In my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.