_STD_BEGIN
  #define _Compiler_barrier()	_ReadWriteBarrier()

 int __cdecl _Atomic_flag_test_and_set(volatile _Atomic_flag_t *_Flag,
	memory_order _Order)
	{	/* atomically test flag and set to true */
	return (_interlockedbittestandset(_Flag, 1));	/* set bit 0 */
	}
Exemple #2
0
 void pilo::core::threading::recursive_mutex::__unlock()
 {
     long const offset = lock_flag_value;
     long const old_count = PILO_WIN_INTERLOCKED_EXCHANGE_ADD(&_m_active_count, lock_flag_value);
     if (!(old_count&event_set_flag_value) && (old_count > offset))
     {
         if (! _interlockedbittestandset(&_m_active_count, event_set_flag_bit))
         {
             ::SetEvent(___get_event());
         }
     }
 }
 inline bool interlocked_bit_test_and_set(long* x,long bit)
 {
     return _interlockedbittestandset(x,bit)!=0;
 }
Exemple #4
0
unsigned char test_interlockedbittestandset(volatile LONG *ptr, LONG bit) {
  return _interlockedbittestandset(ptr, bit);
}
Exemple #5
0
 bool pilo::core::threading::recursive_mutex::__try_lock()
 {
     return (_interlockedbittestandset(&_m_active_count, lock_flag_bit) == 0);
 }
	void AcquireLock()
	{
		LONG *p = (LONG*)&mutex;
		while (_interlockedbittestandset(p,0)) YieldProcessor();
	}