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

+7 -5
View File
@@ -25,7 +25,9 @@ void* pongo_helper(void* ptr) {
pongo_thr_running = 1;
pthread_cleanup_push(thr_cleanup, &pongo_thr_running);
wait_for_pongo();
palerain_block();
while (get_spin()) {
sleep(1);
}
pthread_cleanup_pop(1);
return NULL;
}
@@ -139,7 +141,7 @@ done:
#ifdef USE_LIBUSB
libusb_unref_device(arg->dev);
#endif
palerain_unblock();
set_spin(0);
return NULL;
}
@@ -234,7 +236,7 @@ void io_start(stuff_t *stuff)
if(r != 0)
{
ERR("pthread_create: %s", strerror(r));
palerain_unblock();
set_spin(0);
return;
}
pthread_join(stuff->th, NULL);
@@ -246,14 +248,14 @@ void io_stop(stuff_t *stuff)
if(r != 0)
{
ERR("pthread_cancel: %s", strerror(r));
palerain_unblock();
set_spin(0);
return;
}
r = pthread_join(stuff->th, NULL);
if(r != 0)
{
ERR("pthread_join: %s", strerror(r));
palerain_unblock();
set_spin(0);
return;
}
#ifdef USE_LIBUSB