c++ - asm volatile function's output for the provided code -
can explain following function doing:
inline int atomic_exchange_and_add( int * pw, int dv ) { int r; __asm__ __volatile__ ( "lock\n\t" "xadd %1, %0": "=m"( *pw ), "=r"( r ): // outputs (%0, %1) "m"( *pw ), "1"( dv ): // inputs (%2, %3 == %1) "memory", "cc" // clobbers ); }
below call:
void weak_release() // nothrow { if( atomic_exchange_and_add( &weak_count_, -1 ) == 1 ) { destroy(); } }
thanks in advance
Comments
Post a Comment