github.com/tinygo-org/tinygo@v0.31.3-0.20240404173401-90b0bf646c27/src/runtime/interrupt/interrupt_none.go (about)

     1  //go:build !baremetal
     2  
     3  package interrupt
     4  
     5  // State represents the previous global interrupt state.
     6  type State uintptr
     7  
     8  // Disable disables all interrupts and returns the previous interrupt state. It
     9  // can be used in a critical section like this:
    10  //
    11  //	state := interrupt.Disable()
    12  //	// critical section
    13  //	interrupt.Restore(state)
    14  //
    15  // Critical sections can be nested. Make sure to call Restore in the same order
    16  // as you called Disable (this happens naturally with the pattern above).
    17  func Disable() (state State) {
    18  	return 0
    19  }
    20  
    21  // Restore restores interrupts to what they were before. Give the previous state
    22  // returned by Disable as a parameter. If interrupts were disabled before
    23  // calling Disable, this will not re-enable interrupts, allowing for nested
    24  // cricital sections.
    25  func Restore(state State) {}
    26  
    27  // In returns whether the system is currently in an interrupt.
    28  func In() bool {
    29  	// There are no interrupts, so it can't be in one.
    30  	return false
    31  }