(2010/02/05 11:40), KaiGai Kohei wrote:
> (2010/02/04 18:32), Toru Maesaka wrote:
>> Hi!
>>
>> Thanks for your proof of concept.
>>
>>>  From observing your patch, you should be able to develop this as an
>> engine once we make changes to the modular engine subsystem based on
>> your feedback. Your feedback on get() being called inside another
>> function is a good point (thanks!) and I believe some of us have come
>> to an agreement to refactor that area. As for getting your hands on
>> the connection socket, Trond is willing to add it to the API.
> 
> This is an off topic.

And, one more off topic.

Is the do_add_delta() really thread safe?
When we can increment/decrement the specified item inplace, it modifies
the data field of the item, without replacement.
But it does not prevent any other thread read the item to be modified
during memcpy() and memset(). Then, it has a possibility that unlucky
thread read neither old nor new value.

For example, if the new value is "100\0" next to "99\0", and the working
thread is scheduled just after putting the first '1', other thread can
see "19\0" for a while.

For safety, the value should have binary representation and should be
incremented or decremented with atomic operation of CPU. But it is not
a portable way...

Thanks,
-- 
OSS Platform Development Division, NEC
KaiGai Kohei <[email protected]>

Reply via email to