Re: Best (simplest) way to share data between processes

Liste des GroupesRevenir à cl python 
Sujet : Re: Best (simplest) way to share data between processes
De : barry (at) *nospam* barrys-emacs.org (Barry)
Groupes : comp.lang.python
Date : 08. Jul 2024, 00:27:01
Autres entêtes
Message-ID : <mailman.14.1720391247.2981.python-list@python.org>
References : 1 2
User-Agent : iPad Mail (21F90)


On 7 Jul 2024, at 22:13, Chris Green via Python-list <python-list@python.org> wrote:
 
a simple file lock can then
be used to prevent simultaneous access (well, simultaneous access when
the writing process is writing).

There is a simple pattern to make this robust.

Write new values to a tmp file.
Close the tmp file.
Then use os.rename(tmpfile, productionfile).

This is guaranteed that any process that reads the file will only see all the old file contents or all the new file contents,  never a mix of both.

Barry



Date Sujet#  Auteur
6 Jul 24 * Best (simplest) way to share data between processes13Chris Green
6 Jul 24 +- Re: Best (simplest) way to share data between processes1Stefan Ram
6 Jul 24 +* Re: Best (simplest) way to share data between processes2Piergiorgio Sartor
8 Jul 24 i`- Re: Best (simplest) way to share data between processes1Chris Green
7 Jul 24 +* Re: Best (simplest) way to share data (Posting On Python-List Prohibited)5Lawrence D'Oliveiro
8 Jul 24 i`* Re: Best (simplest) way to share data (Posting On Python-List Prohibited)4Chris Green
8 Jul 24 i +* Re: Best (simplest) way to share data2Stefan Ram
9 Jul 24 i i`- Re: Best (simplest) way to share data1Chris Green
9 Jul 24 i `- Re: Best (simplest) way to share data (Posting On Python-List Prohibited)1Lawrence D'Oliveiro
8 Jul 24 +- Re: Best (simplest) way to share data between processes1Barry
8 Jul 24 +- Re: Best (simplest) way to share data between processes1MRAB
8 Jul 24 +- Re: Best (simplest) way to share data between processes1Barry Scott
7 Jul 24 `- Re: Best (simplest) way to share data between processes1Left Right

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal