Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #50413 > unrolled thread
| Started by | Jason Friedman <jsf80238@gmail.com> |
|---|---|
| First post | 2013-07-10 22:57 -0600 |
| Last post | 2013-07-11 09:30 +0100 |
| Articles | 2 — 2 participants |
Back to article view | Back to comp.lang.python
Concurrent writes to the same file Jason Friedman <jsf80238@gmail.com> - 2013-07-10 22:57 -0600
Re: Concurrent writes to the same file Nobody <nobody@nowhere.com> - 2013-07-11 09:30 +0100
| From | Jason Friedman <jsf80238@gmail.com> |
|---|---|
| Date | 2013-07-10 22:57 -0600 |
| Subject | Concurrent writes to the same file |
| Message-ID | <mailman.4565.1373518632.3114.python-list@python.org> |
[Multipart message — attachments visible in raw view] — view raw
Other than using a database, what are my options for allowing two processes to edit the same file at the same time? When I say same time, I can accept delays. I considered lock files, but I cannot conceive of how I avoid race conditions.
[toc] | [next] | [standalone]
| From | Nobody <nobody@nowhere.com> |
|---|---|
| Date | 2013-07-11 09:30 +0100 |
| Message-ID | <pan.2013.07.11.08.30.35.284000@nowhere.com> |
| In reply to | #50413 |
On Wed, 10 Jul 2013 22:57:09 -0600, Jason Friedman wrote: > Other than using a database, what are my options for allowing two processes > to edit the same file at the same time? When I say same time, I can accept > delays. What do you mean by "edit"? Overwriting bytes and appending bytes are simple enough, but inserting or deleting bytes such that subsequent bytes change their offsets is harder. > I considered lock files, Well, you shouldn't have, unless you're targeting a platform which doesn't support file locks (are there any left?). > but I cannot conceive of how I avoid race conditions. By using locks. E.g. fcntl.lockf() or msvcrt.locking().
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web