From 734dfb9392c151beefd6169b9dd14cdddfcb7f71 Mon Sep 17 00:00:00 2001 From: noah the goodra Date: Thu, 11 Oct 2018 11:20:54 -0500 Subject: [PATCH] threading changes observed in libnx --- python_config/condvar.h | 6 +++--- python_config/thread_nx.h | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/python_config/condvar.h b/python_config/condvar.h index d3ea5f7..e876cb6 100644 --- a/python_config/condvar.h +++ b/python_config/condvar.h @@ -150,14 +150,14 @@ PyMUTEX_UNLOCK(PyMUTEX_T *mut) { Py_LOCAL_INLINE(int) PyCOND_INIT(PyCOND_T *cond, PyMUTEX_T *mut) { - condvarInit(cond, mut); + condvarInit(cond); return 0; } #define PyCOND_FINI(cond) 0 #define PyCOND_SIGNAL(cond) condvarWakeOne((cond)) #define PyCOND_BROADCAST(cond) condvarWakeAll((cond)) -#define PyCOND_WAIT(cond, mut) condvarWait((cond)) +#define PyCOND_WAIT(cond, mut) condvarWait((cond),mut) /* return 0 for success, 1 on timeout, -1 on error */ Py_LOCAL_INLINE(int) @@ -166,7 +166,7 @@ PyCOND_TIMEDWAIT(PyCOND_T *cond, PyMUTEX_T *mut, PY_LONG_LONG us) int r; u64 ns = us * 1000; // microseconds to nanoseconds - r = condvarWaitTimeout((cond), ns); + r = condvarWaitTimeout((cond),mut, ns); if (r == 0xEA01) return 1; else if (r) diff --git a/python_config/thread_nx.h b/python_config/thread_nx.h index 04ff8b7..53a814c 100644 --- a/python_config/thread_nx.h +++ b/python_config/thread_nx.h @@ -139,7 +139,7 @@ PyThread_allocate_lock(void) mutexInit(&(lock->mutex)); - condvarInit(&(lock->cv), &(lock->mutex)); + condvarInit(&(lock->cv)); dprintf(("PyThread_allocate_lock() -> %p\n", lock)); return (PyThread_type_lock) lock; @@ -193,12 +193,12 @@ PyThread_acquire_lock_timed(PyThread_type_lock lock, PY_TIMEOUT_T microseconds, success = PY_LOCK_FAILURE; while (success == PY_LOCK_FAILURE) { if (microseconds > 0) { - status = condvarWaitTimeout(&(thelock->cv), ns); + status = condvarWaitTimeout(&(thelock->cv),&(thelock->mutex), ns); if (status == 0xEA01) // on timeout break; } else { - status = condvarWait(&(thelock->cv)); + status = condvarWait(&(thelock->cv),&(thelock->mutex)); } if (intr_flag && status == 0 && thelock->locked) {