• Brad Fitzpatrick's avatar
    database/sql: associate a mutex with each driver interface · f28c8fba
    Brad Fitzpatrick authored
    The database/sql/driver docs make this promise:
    
       "Conn is a connection to a database. It is not used
       concurrently by multiple goroutines."
    
    That promises exists as part of database/sql's overall
    goal of making drivers relatively easy to write.
    
    So far this promise has been kept without the use of locks by
    being careful in the database/sql package, but sometimes too
    careful. (cf. golang.org/issue/3857)
    
    The CL associates a Mutex with each driver.Conn, and with the
    interface value progeny thereof. (e.g. each driver.Tx,
    driver.Stmt, driver.Rows, driver.Result, etc) Then whenever
    those interface values are used, the Locker is locked.
    
    This CL should be a no-op (aside from some new Lock/Unlock
    pairs) and doesn't attempt to fix Issue 3857 or Issue 4459,
    but should make it much easier in a subsequent CL.
    
    Update #3857
    
    R=golang-dev, adg
    CC=golang-dev
    https://golang.org/cl/7803043
    f28c8fba
Name
Last commit
Last update
..
cmd Loading commit data...
lib9 Loading commit data...
libbio Loading commit data...
libmach Loading commit data...
pkg Loading commit data...
Make.dist Loading commit data...
all.bash Loading commit data...
all.bat Loading commit data...
all.rc Loading commit data...
clean.bash Loading commit data...
clean.bat Loading commit data...
clean.rc Loading commit data...
make.bash Loading commit data...
make.bat Loading commit data...
make.rc Loading commit data...
race.bash Loading commit data...
race.bat Loading commit data...
run.bash Loading commit data...
run.bat Loading commit data...
run.rc Loading commit data...
sudo.bash Loading commit data...