This is typically available in RTOSes, to combine with a spinlock for a short critical section.
Can you accomplish the rough equivalent by temporarily maximizing thre