remove spinlocks

This commit is contained in:
Nick Chan committed 2024-09-21 20:06:43 +08:00
1 parent 3a404501f7
commit 1670c26313
6 files changed
+32 -34

No files matched your search

+8 -5
View File
@@ -30,8 +30,9 @@
#include <paleinfo.h>
pthread_mutex_t spin_mutex, found_pongo_mutex, ecid_dfu_wait_mutex;
pthread_cond_t spin;
bool spin, found_pongo = 0;
bool found_pongo = 0;
uint64_t ecid_wait_for_dfu = 0;
static bool get_locked_bool(bool* val, pthread_mutex_t* mutex) {
@@ -50,12 +51,14 @@ static bool set_locked_bool(bool* val, bool newval, pthread_mutex_t* mutex) {
return newval;
}
bool get_spin(void) {
return get_locked_bool(&spin, &spin_mutex);
bool palerain_block(void) {
pthread_mutex_lock(&spin_mutex);
pthread_cond_wait(&spin, &spin_mutex);
pthread_mutex_unlock(&spin_mutex);
}
bool set_spin(bool newval) {
return set_locked_bool(&spin, newval, &spin_mutex);
bool palerain_unblock(void) {
pthread_cond_broadcast(&spin);
}
bool get_found_pongo(void) {