[Python-ideas] Concurrent safety?

Greg Ewing greg.ewing at canterbury.ac.nz
Tue Nov 1 07:00:15 CET 2011


Mike Meyer wrote:
> The goal here is to move from where we are to a place similar to where 
> handling files is, so that failing to properly deal with the possibility 
> of concurrent access causes an error when it happens, not at a point 
> distant in both time and space.

I don't think what you're suggesting would achieve this,
though. The locking required for correctness often involves
more than one object or more than one operation on an
object. Consider

    new_balance = balance + deposit
    lock(balance)
    balance = new_balance
    unlock(balance)

This wouldn't trigger any of your alarms, but it would
still be wrong.

-- 
Greg



More information about the Python-ideas mailing list