1. A method, comprising: performing by a computer: beginning execution of a multithreaded application that comprises one or more requests to acquire a shared lock, wherein the shared lock controls access to a critical section of code or a shared resource by concurrently executing threads of the application, and wherein only one thread can hold the shared lock at a time; a thread of the application acquiring the shared lock, wherein the thread is executing on one of a plurality of processor cores in a cluster of processor cores that share a memory, and wherein the cluster of processor cores is one of a plurality of clusters of processor cores on which threads of the multithreaded application are executing; in response to acquiring the shared lock, the thread: accessing the critical section of code or shared resource; and subsequent to said accessing: determining whether any other threads of the application that are executing on a processor core in the cluster of processor cores are waiting to access the critical section of code or shared resource; and in response to determining that at least one other thread of the application that is executing on a processor core in the cluster of processor cores is waiting to acquire the shared lock, passing ownership of a cluster-specific lock that is associated with the critical section of code or shared resource to another thread of the application that is executing on a processor core in the cluster of processor cores and that is waiting to access the critical section of code or shared resource without releasing the shared lock, wherein said passing allows the other thread to gain access to the critical section of code or shared resource.