Atmel SAM4S Xplained Pro Starter Kit Atmel ATSAM4S-XSTK ATSAM4S-XSTK Data Sheet

Product codes
ATSAM4S-XSTK
Page of 1125
 103
SAM4S [DATASHEET]
11100E–ATARM–24-Jul-13
    CMPEQ   R0, #0              ; Did this succeed?
    BNE     try                 ; No – try again
    ....                        ; Yes – we have the lock
12.6.4.9 CLREX
Clear Exclusive. 
Syntax
CLREX{cond}
where:
cond
Operation
Use CLREX to make the next STREX, STREXB, or STREXH instruction write 1 to its destination register and fail to
perform the store. It is useful in exception handler code to force the failure of the store exclusive if the exception occurs
between a load exclusive instruction and the matching store exclusive instruction in a synchronization operation.
See 
 for more information.
Condition Flags
These instructions do not change the flags.
Examples
CLREX