From 91360e7d3cb0dc0934539b3bcad6ac6e8572678c Mon Sep 17 00:00:00 2001 From: Ondrej Mikle Date: Sun, 29 Oct 2017 22:28:30 +0100 Subject: [PATCH] Comment about GIL while polling with NFC reader --- nfc_smartcard.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nfc_smartcard.cpp b/nfc_smartcard.cpp index 89ac373..64a78b7 100644 --- a/nfc_smartcard.cpp +++ b/nfc_smartcard.cpp @@ -104,6 +104,8 @@ std::string NFCDevice::scanUID() throw(NFCError) throw NFCError("NFC device not opened"); } + // We release GIL because otherwise it would block other threads. Since this polling is de-facto sleep and + // doesn't touch any variables, it works as a language without GIL would. Py_BEGIN_ALLOW_THREADS res = nfc_initiator_poll_target(_nfcDevice, _modulations, _modulationsLen, pollNr, pollPeriod, &nt); Py_END_ALLOW_THREADS