MySQL自旋鎖-spin lock
一篇算是介紹innodb鎖比較有條理的文章
https://blog.csdn.net/sun_ashe/article/details/81291347
innodb默認用typedef PolicyMutex<TTASEventMutex<GenericPolicy> > SyncArrayMutex;
核心是mysql自己通過TAS原子操作實現了自旋鎖,但網上資料介紹說futex和pthread_mutex的效率在新版本上優于spin_mutex;
阿里在優化polarDB時也使用futex
innodb.cmake中
SET(MUTEXTYPE "event" CACHE STRING "Mutex type: event, sys or futex") 控制了編譯的鎖類型