We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5c8db6b commit a764f57Copy full SHA for a764f57
source/py_gpio.c
@@ -185,6 +185,10 @@ static void run_py_callbacks(unsigned int gpio)
185
gettimeofday(&tv_timenow, NULL);
186
timenow = tv_timenow.tv_sec*1E6 + tv_timenow.tv_usec;
187
if (cb->bouncetime == 0 || timenow - cb->lastcall > cb->bouncetime*1000 || cb->lastcall == 0 || cb->lastcall > timenow) {
188
+
189
+ // save lastcall before calling func to prevent reentrant bounce
190
+ cb->lastcall = timenow;
191
192
// run callback
193
gstate = PyGILState_Ensure();
194
result = PyObject_CallFunction(cb->py_cb, "s", cb->channel);
0 commit comments