|
1 | | ---- interpreter/Python-3.6.8/Python/condvar.h 2018-12-23 22:37:14.000000000 +0100 |
2 | | -+++ python_patches/condvar.h 2019-05-25 20:47:58.217332113 +0200 |
3 | | -@@ -109,6 +109,69 @@ |
4 | | - return 0; |
5 | | - } |
6 | | - |
7 | | -+#elif defined(_3DS) |
8 | | -+ |
9 | | -+#define Py_HAVE_CONDVAR |
10 | | -+ |
11 | | -+#include "condvars_ctr.h" |
12 | | -+ |
13 | | -+/* The following functions return 0 on success, nonzero on error. */ |
14 | | -+#define PyMUTEX_T LightLock |
15 | | -+ |
16 | | -+Py_LOCAL_INLINE(int) |
17 | | -+PyMUTEX_INIT(PyMUTEX_T *mut) { |
18 | | -+ LightLock_Init(mut); |
19 | | -+ return 0; |
20 | | -+} |
21 | | -+ |
22 | | -+Py_LOCAL_INLINE(int) |
23 | | -+PyMUTEX_FINI(PyMUTEX_T *mut) { |
24 | | -+ LightLock_Init(mut); |
25 | | -+ return 0; |
26 | | -+} |
27 | | -+ |
28 | | -+Py_LOCAL_INLINE(int) |
29 | | -+PyMUTEX_LOCK(PyMUTEX_T *mut) { |
30 | | -+ LightLock_Lock(mut); |
31 | | -+ return 0; |
32 | | -+} |
33 | | -+ |
34 | | -+Py_LOCAL_INLINE(int) |
35 | | -+PyMUTEX_UNLOCK(PyMUTEX_T *mut) { |
36 | | -+ LightLock_Unlock(mut); |
37 | | -+ return 0; |
38 | | -+} |
39 | | -+ |
40 | | -+#define PyCOND_T CondVar |
41 | | -+ |
42 | | -+Py_LOCAL_INLINE(int) |
43 | | -+PyCOND_INIT(PyCOND_T *cond, PyMUTEX_T *mut) { |
44 | | -+ CondVar_Init(cond, mut); |
45 | | -+ return 0; |
46 | | -+} |
47 | | -+ |
48 | | -+ |
49 | | -+#define PyCOND_FINI(cond) 0 |
50 | | -+#define PyCOND_SIGNAL(cond) CondVar_NotifyOne((cond)) |
51 | | -+#define PyCOND_BROADCAST(cond) CondVar_NotifyAll((cond)) |
52 | | -+#define PyCOND_WAIT(cond, mut) CondVar_Wait((cond), (mut)) |
53 | | -+ |
54 | | -+/* Return 0 for success, 1 on timeout, -1 on error. */ |
55 | | -+Py_LOCAL_INLINE(int) |
56 | | -+PyCOND_TIMEDWAIT(PyCOND_T *cond, PyMUTEX_T *mut, PY_LONG_LONG us) |
57 | | -+{ |
58 | | -+ bool r; |
59 | | -+ u64 ns = us * 1000; // microseconds to nanoseconds |
60 | | -+ |
61 | | -+ r = CondVar_WaitTimeout((cond), (mut), ns); |
62 | | -+ if (r == 1) |
63 | | -+ return 0; |
64 | | -+ else if (!r) // timeout |
65 | | -+ return 0; |
66 | | -+ else |
67 | | -+ return -1; |
68 | | -+} |
69 | | -+ |
70 | | - #elif defined(NT_THREADS) |
71 | | - /* |
72 | | - * Windows (XP, 2003 server and later, as well as (hopefully) CE) support |
| 1 | +*** interpreter/Python-3.6.9/Python/condvar.h 2019-07-02 22:25:39.000000000 +0200 |
| 2 | +--- python_patches/condvar.h 2019-07-25 21:35:50.697632088 +0200 |
| 3 | +*************** |
| 4 | +*** 109,114 **** |
| 5 | +--- 109,177 ---- |
| 6 | + return 0; |
| 7 | + } |
| 8 | + |
| 9 | ++ #elif defined(_3DS) |
| 10 | ++ |
| 11 | ++ #define Py_HAVE_CONDVAR |
| 12 | ++ |
| 13 | ++ #include "condvars_ctr.h" |
| 14 | ++ |
| 15 | ++ /* The following functions return 0 on success, nonzero on error. */ |
| 16 | ++ #define PyMUTEX_T LightLock |
| 17 | ++ |
| 18 | ++ Py_LOCAL_INLINE(int) |
| 19 | ++ PyMUTEX_INIT(PyMUTEX_T *mut) { |
| 20 | ++ LightLock_Init(mut); |
| 21 | ++ return 0; |
| 22 | ++ } |
| 23 | ++ |
| 24 | ++ Py_LOCAL_INLINE(int) |
| 25 | ++ PyMUTEX_FINI(PyMUTEX_T *mut) { |
| 26 | ++ LightLock_Init(mut); |
| 27 | ++ return 0; |
| 28 | ++ } |
| 29 | ++ |
| 30 | ++ Py_LOCAL_INLINE(int) |
| 31 | ++ PyMUTEX_LOCK(PyMUTEX_T *mut) { |
| 32 | ++ LightLock_Lock(mut); |
| 33 | ++ return 0; |
| 34 | ++ } |
| 35 | ++ |
| 36 | ++ Py_LOCAL_INLINE(int) |
| 37 | ++ PyMUTEX_UNLOCK(PyMUTEX_T *mut) { |
| 38 | ++ LightLock_Unlock(mut); |
| 39 | ++ return 0; |
| 40 | ++ } |
| 41 | ++ |
| 42 | ++ #define PyCOND_T CondVar |
| 43 | ++ |
| 44 | ++ Py_LOCAL_INLINE(int) |
| 45 | ++ PyCOND_INIT(PyCOND_T *cond, PyMUTEX_T *mut) { |
| 46 | ++ CondVar_Init(cond, mut); |
| 47 | ++ return 0; |
| 48 | ++ } |
| 49 | ++ |
| 50 | ++ |
| 51 | ++ #define PyCOND_FINI(cond) 0 |
| 52 | ++ #define PyCOND_SIGNAL(cond) CondVar_NotifyOne((cond)) |
| 53 | ++ #define PyCOND_BROADCAST(cond) CondVar_NotifyAll((cond)) |
| 54 | ++ #define PyCOND_WAIT(cond, mut) CondVar_Wait((cond), (mut)) |
| 55 | ++ |
| 56 | ++ /* Return 0 for success, 1 on timeout, -1 on error. */ |
| 57 | ++ Py_LOCAL_INLINE(int) |
| 58 | ++ PyCOND_TIMEDWAIT(PyCOND_T *cond, PyMUTEX_T *mut, PY_LONG_LONG us) |
| 59 | ++ { |
| 60 | ++ bool r; |
| 61 | ++ u64 ns = us * 1000; // microseconds to nanoseconds |
| 62 | ++ |
| 63 | ++ r = CondVar_WaitTimeout((cond), (mut), ns); |
| 64 | ++ if (r == 1) |
| 65 | ++ return 0; |
| 66 | ++ else if (!r) // timeout |
| 67 | ++ return 0; |
| 68 | ++ else |
| 69 | ++ return -1; |
| 70 | ++ } |
| 71 | ++ |
| 72 | + #elif defined(NT_THREADS) |
| 73 | + /* |
| 74 | + * Windows (XP, 2003 server and later, as well as (hopefully) CE) support |
0 commit comments