CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2005
    Posts
    2

    Lightbulb Shared memory that survives application crash

    Hi all,

    i`m searching for linux c functions or library, where i can create shared memory used by application, that can survive application crash and when application is restarted, then this application can access this memory.

    Is this possible ?

  2. #2
    Join Date
    Feb 2005
    Location
    Normandy in France
    Posts
    4,590

    Re: Shared memory that survives application crash

    You can do that by creating a small process which will contain the data.
    This process must be a little stable executable.

    This process will communicate with the application through COM, or a pipe, or window messages, or any interprocess communication technique.
    This process will be created, if not already existing, on application's startup.
    If it already exists, the application will use this process to get the data.
    This process will not be exited when the main application crashes.

    You can optionally, exit or not, the process, when the main application exits properly, depending whether you want, or not, get the data at the next application startup.

    If you want to support unexpected PC crash and reboot, you'll need to save the data in a file.

    I am not sure, but a file mapping may also be used (in that case, the second process is not necessary). I suppose that the file map is saved to the file if the process crashes, but I'm not sure.
    "inherit to be reused by code that uses the base class, not to reuse base class code", Sutter and Alexandrescu, C++ Coding Standards.
    Club of lovers of the C++ typecasts cute syntax: Only recorded member.

    Out of memory happens! Handle it properly!
    Say no to g_new()!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured