mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
Fix mutex locking.
This commit is contained in:
parent
ef43cb25ac
commit
6f02fa2114
@ -38,14 +38,13 @@ static void _mutex_lock(omv_mutex_t *mutex, uint32_t tid, bool blocking)
|
|||||||
} while (mutex->tid != tid && blocking);
|
} while (mutex->tid != tid && blocking);
|
||||||
#else
|
#else
|
||||||
do {
|
do {
|
||||||
// Attempt exclusive read
|
// Attempt to lock the mutex
|
||||||
while (__LDREXW(&mutex->lock) != 0);
|
if (__LDREXW(&mutex->lock) == 0) {
|
||||||
|
if (__STREXW(1, &mutex->lock) == 0) {
|
||||||
// Attempt to lock mutex
|
|
||||||
if(__STREXW(1, &mutex->lock) == 0) {
|
|
||||||
// Set TID if mutex is locked
|
// Set TID if mutex is locked
|
||||||
mutex->tid = tid;
|
mutex->tid = tid;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} while (mutex->tid != tid && blocking);
|
} while (mutex->tid != tid && blocking);
|
||||||
#endif
|
#endif
|
||||||
__DMB();
|
__DMB();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user