1. A non-transitory, computer-readable storage medium storing program instructions that when executed on a computing device cause the computing device to perform: acquiring, by a first thread of a multi-threaded application, a lock associated with a portion of shared memory accessible by threads of the multi-threaded application, wherein while the lock is acquired by the first thread, the lock is unavailable to one or more other threads of the multi-threaded application; in response to determining, by another thread of the one or more other threads of the multi-threaded application, that the lock is to be elided and is unavailable: executing, by the other thread, an instrumented version of a critical section of code using a hardware transaction; wherein write operations, but not read operations, of the instrumented version of the critical section are instrumented to detect data conflicts when accessing the portion of shared memory; and wherein the multi-threaded application includes both the instrumented version and an unmodified version of the critical section.