Revert "remove spinlocks"

This reverts commit 1670c26313.
This commit is contained in:
Nick Chan committed 2024-09-23 15:50:58 +08:00
1 parent ff94a8281d
commit d9dfefadcb
6 files changed
+34 -32

No files matched your search

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