|
Boost Users : |
Subject: Re: [Boost-users] [interprocesss] managed_mapped_file mutex question
From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2010-03-19 06:06:35
El 19/03/2010 6:00, Andy Wiese escribió:
> I have a couple of questions about crash protection, which is very
> important in this case:
> 1. I am using only file_lock, because it is guaranteed to be released if
> the process crashes (if I understand correctly). However, file_lock has
> its limitations. If I use a named_recursive_mutex instead, is there any
> way to clear the mutex if the process terminates while holding the mutex?
No, this is a difficult problem to solve. I plan to work on this when I
get some time but this is one of the weak points of the library.
> 2. If the mapped file gets corrupted, e.g. if a process gets killed
> while writing the file, I need to be able to detect that case and
> rebuild the file, but the file is certain death to any process that
> touches it, so validating it seems messy. Any suggestions how to detect
> a bad file?
This depends on your application, and it's similar to when a thread
corrupts a data structure used by another thread. You could serialize
them and mark the start and end of a modification, so that a thread
could check if a previous process/thread has finished the modification.
This obviously, requires collaborative processes.
Best,
Ion
>
> Andy
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net