Enter a critical section, i.e., a section that will not be interrupted by any other task or interrupt. On multi-core systems, this will disable interrupts and take the spinlock \c lock. On single core systems, a spinlock is unncessary, hence \c lock is ignored and interrupts are disabled only. Example usage with static locks:
{c}
...
#include "os/critical_section.h"
...
DEFINE_CRIT_SECTION_LOCK_STATIC(my_lock); // will have internal linking (static)
...
esp_os_enter_critical(&my_lock);
// code inside critical section
esp_os_exit_critical(&my_lock);