-ushort prev;
-
- do {
-#ifdef unix
- prev = __sync_fetch_and_or((ushort *)latch, PEND | XCL);
-#else
- prev = _InterlockedOr16((ushort *)latch, PEND | XCL);
-#endif
- if( !(prev & XCL) )
- if( !(prev & ~BOTH) )
- return;
- else
-#ifdef unix
- __sync_fetch_and_and ((ushort *)latch, ~XCL);
-#else
- _InterlockedAnd16((ushort *)latch, ~XCL);
-#endif
-#ifdef unix
- } while( sched_yield(), 1 );
-#else
- } while( SwitchToThread(), 1 );
-#endif
-/*
-unsigned char prev;
-
- do {
-#ifdef unix
- prev = __sync_fetch_and_or(latch->exclusive, XCL);
-#else
- prev = _InterlockedOr8(latch->exclusive, XCL);
-#endif
- if( !(prev & XCL) )
- return;
-#ifdef unix
- } while( sched_yield(), 1 );
-#else
- } while( SwitchToThread(), 1 );
-#endif
-*/
-/*