Is incr/decr atomic in multithread mode?
Steve Chu
stvchu at gmail.com
Mon Feb 25 06:25:26 UTC 2008
In 'process_arithmetic_command' function:
We first do item_get from slabs and then do add_delta to incr/decr the value.
My question is:
Is this atomic in multithread mode? Item_get is atomic and so is
add_delta because they are protected by mutex. But the entire two
operations seems NOT atomic. Two threads can both do item_get with
same key, then both incr it, and write back.
Anybody can tell me whether it is a bug or not?
Regards,
Steve Chu
More information about the memcached
mailing list