Mike - EMAIL IGNORED <[EMAIL PROTECTED]> writes:

> My purpose is not relevant,

It is, if you want a useful answer.

> but I assure you that the requirement is correctly stated.

Where did you state your requirements? I must have missed that.
So far all I've seen is incoherent "when I do this, result is not
what I expect".

> I confirmed that I can open the file O_RDWR simultaneously from
> two processes.

Yes, that's correct on UNIX; but not on Win32.

Note that (AFAICT) you never mentioned two processes before this
point, so the answers you've got related to a *single* process.

> Seems to me like a good way to make a mess of a file.

If you want multiple processes to cooperate on writing a single file,
the proper way to achive that is with "advisory file locking"; see
"man flock".

> I guess I will use a locking file opened from a singleton.

This approach has the problem that if "lock holder" dies, then no
other process can do anything until "manual" cleanup. Advisory
file locking avoids that -- the locks are cleaned by kernel when
the process dies.

Also, whether the locking file is opened from singleton or not is
irrelevant -- singleton doesn't help you in any way that I can see
(given your statement of the problem so far), and singleton doesn't
work across processes.

Finally, may I suggest some light reading for the New Year:
  http://catb.org/~esr/faqs/smart-questions.html

Cheers,
-- 
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.
_______________________________________________
help-gplusplus mailing list
help-gplusplus@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gplusplus

Reply via email to