Bypassing the POST routine

You can bypass the POST routine whenever the corresponding WAIT has not yet been issued if the wait bit is not on. In this case, a compare-and-swap (CS) instruction can be used to quick post the ECB. The compare operand should reflect the ECB content with the wait and post bits off, and the swap operand should have the post bit on and contain the desired post code. If the wait bit is on in the ECB, the CS will fail (giving a non-zero condition code), and the normal POST routine must be executed. If the wait bit is not on, the CS will, in effect, post the completion of the event. Note that holding the LOCAL lock does not eliminate the requirement to use the CS instruction. Figure 1 demonstrates an example of how to quick post an ECB.
Figure 1. Bypassing the POST Routine
        L  RX,ECB          Get contents of ECB.
        N  RX,=X'3FFFFFFF' Turn off wait and post bits
        L  RY,=X'40000000' Post bit and post code
        CS RX,RY,ECB       Compare and swap to post ECB
        BZ POSTDONE        Branch if CS is successful
        LTR RX,RX          Wait bit on?
        BM DOPOST          If yes, then execute POST
        N  RX,=X'40000000' Is ECB posted?
        BNZ POSTDONE       If yes, do not execute POST
DOPOST  POST ECB
POSTDONE EQU  *