Skip to content

File syn_spinlock.h

FileList > src > syntropic > util > syn_spinlock.h

Go to the source code of this file

Scoped spinlock helper for shared resource protection. More...

Detailed Description

Convenience wrapper around the spinlock port functions. Provides an RAII-style scoped lock that guarantees release on scope exit.

** **

// Protect a shared UART across two cores
SYN_SPINLOCK_GUARD(SYN_SPINLOCK_UART) {
    syn_port_uart_transmit(0, data, len, 10);
}

** **

Define your own in syn_config.h or use the defaults: * SYN_SPINLOCK_UART (0) — Shared UART access * SYN_SPINLOCK_FLASH (1) — Shared flash access * SYN_SPINLOCK_USER0 (2) — Application use * SYN_SPINLOCK_USER1 (3) — Application use


The documentation for this class was generated from the following file src/syntropic/util/syn_spinlock.h