[Zope] ConflictError (ID-Counter for all Documents)

Thomas Guettler Thomas Guettler <thomas@thomas-guettler.de>
Sat, 26 Jan 2002 10:24:46 +0100


On Fri, Jan 25, 2002 at 10:05:21AM +0000, seb bacon wrote:
> I haven't followed this thread, so feel free to shoot me down - but
> what's wrong with making an autoincrement product which spits out
> [number++] each time it is called?

The Problem is:
 last_id=last_id+1

1. Thread1 reads last_id=4
2. Thread2 reads last_id=4
3. Thread1 writes last_id=4+1
4. Thread2 writes last_id=4+1

--> two IDs with the same number


-- 
Thomas Guettler <guettli@thomas-guettler.de>
http://www.thomas-guettler.de