Executes the provided callbacks depending on if the switch is either on or off waiting for any pending changes to happen before (locking) Be careful of longrunning or blocking within the provided action as it can lead to deadlocks or bad performance
Executes the provided action and returns if the action was executed or not, if the switch is IMMEDIATELY off (i.
Executes the provided action and returns if the action was executed or not, if the switch is IMMEDIATELY off (i.e. no lock involved)
Executes the provided action and returns its value if the switch is IMMEDIATELY off (i.
Executes the provided action and returns its value if the switch is IMMEDIATELY off (i.e. no lock involved)
Executes the provided action and returns if the action was executed or not, if the switch is IMMEDIATELY on (i.
Executes the provided action and returns if the action was executed or not, if the switch is IMMEDIATELY on (i.e. no lock involved)
Executes the provided action and returns its value if the switch is IMMEDIATELY on (i.
Executes the provided action and returns its value if the switch is IMMEDIATELY on (i.e. no lock involved)
Returns whether the switch is IMMEDDIATELY off (no locking)
Returns whether the switch is IMMEDIATELY on (no locking)
Executes the given code while holding this switch’s lock, i.
Executes the given code while holding this switch’s lock, i.e. protected from concurrent modification of the switch status.
Switches the switch off (if on), uses locking
Executes the provided action if the lock is on under a lock, so be _very_ careful with longrunning/blocking operations in it Only executes the action if the switch is on, and switches it off immediately after obtaining the lock Will switch it back on if the provided action throws an exception
Switches the switch on (if off), uses locking
Executes the provided action if the lock is off under a lock, so be _very_ careful with longrunning/blocking operations in it Only executes the action if the switch is off, and switches it on immediately after obtaining the lock Will switch it back off if the provided action throws an exception
Executes the provided action and returns if the action was executed or not, if the switch is off, waiting for any pending changes to happen before (locking) Be careful of longrunning or blocking within the provided action as it can lead to deadlocks or bad performance
Executes the provided action and returns its value if the switch is off, waiting for any pending changes to happen before (locking) Be careful of longrunning or blocking within the provided action as it can lead to deadlocks or bad performance
Executes the provided action and returns if the action was executed or not, if the switch is on, waiting for any pending changes to happen before (locking) Be careful of longrunning or blocking within the provided action as it can lead to deadlocks or bad performance
Executes the provided action and returns its value if the switch is on, waiting for any pending changes to happen before (locking) Be careful of longrunning or blocking within the provided action as it can lead to deadlocks or bad performance
An atomic switch that can be either on or off