Protect idle func contexts with a sync.RWMutex.