mirror of
https://github.com/palera1n/palera1n.git
synced 2026-12-06 08:14:49 +01:00
remove spinlocks
This commit is contained in:
1 parent
3a404501f7
commit
1670c26313
6 files changed
+32
-34
No files matched your search
+8
-5
@@ -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) {
|
||||
|
||||
Reference in new issue
Block a user