Merge pull request #107 from larics/master

fixed usage of atomic operation lib for armcc compiler, added conditi…
This commit is contained in:
Pavel Kirienko 2017-05-28 18:17:01 +03:00 committed by GitHub
commit a15ba77214

View File

@ -142,17 +142,35 @@ public:
{
(void)duration;
bool lready = ready;
return __atomic_exchange_n (&lready, false, __ATOMIC_SEQ_CST);
#if defined ( __CC_ARM )
return __sync_lock_test_and_set(&lready, false);
#elif defined ( __GNUC__ )
return __atomic_exchange_n (&lready, false, __ATOMIC_SEQ_CST);
#else
# error "This compiler is not supported"
#endif
}
void signal()
{
__atomic_store_n (&ready, true, __ATOMIC_SEQ_CST);
#if defined ( __CC_ARM )
__sync_lock_release(&ready);
#elif defined ( __GNUC__ )
__atomic_store_n (&ready, true, __ATOMIC_SEQ_CST);
#else
# error "This compiler is not supported"
#endif
}
void signalFromInterrupt()
{
__atomic_store_n (&ready, true, __ATOMIC_SEQ_CST);
#if defined ( __CC_ARM )
__sync_lock_release(&ready);
#elif defined ( __GNUC__ )
__atomic_store_n (&ready, true, __ATOMIC_SEQ_CST);
#else
# error "This compiler is not supported"
#endif
}
};