Skip to content

Property Exclusive

Namespace: Belay.Attributes
Assembly: Belay.Attributes.dll

Exclusive

Gets or sets a value indicating whether gets or sets whether this task method requires exclusive access to the device. When true, ensures no other methods execute concurrently on the device.

csharp
public bool Exclusive { get; set; }

Property Value

bool

Examples

[Task(Exclusive = true)]
public async Task UpdateFirmwareAsync(byte[] firmwareData)
{
    // Critical operation that must not be interrupted
    await ExecuteAsync(@"
        import machine
        # Disable interrupts during firmware update
        machine.disable_irq()
        try:
            write_firmware_data(data)
            verify_firmware()
        finally:
            machine.enable_irq()
    ");
}

Remarks

Use exclusive access for methods that:

  • Modify critical device state
  • Require exclusive hardware resource access
  • Cannot be safely interrupted by other operations

Exclusive methods may reduce overall system performance by blocking other operations, so use sparingly and only when necessary for correctness.

Released under the Apache License 2.0.