1. A method for reading a location in a shared memory, the method comprising: receiving a shared memory read instruction for the location in the shared memory for multiple parallel threads of a program; determining that the shared memory read instruction includes a lock command suffix indicating that a lock of the location is requested; and returning a lock result indicating whether or not the lock of the location was acquired for the shared memory read instruction, wherein execution across the multiple parallel threads diverges when the lock result indicates that at least one of the multiple parallel threads did not acquire the lock.