[Pcsclite-cvs-commit] r5029 - in /trunk/PCSC/src: PCSC/ifdhandler.h eventhandler.c

rousseau at users.alioth.debian.org rousseau at users.alioth.debian.org
Tue Jun 22 09:28:36 UTC 2010


Author: rousseau
Date: Tue Jun 22 09:28:35 2010
New Revision: 5029

URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=5029
Log:
Add support of TAG_IFD_STOP_POLLING_THREAD to request the stop of the
driver polling function.

Modified:
    trunk/PCSC/src/PCSC/ifdhandler.h
    trunk/PCSC/src/eventhandler.c

Modified: trunk/PCSC/src/PCSC/ifdhandler.h
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/PCSC/ifdhandler.h?rev=5029&op=diff
==============================================================================
--- trunk/PCSC/src/PCSC/ifdhandler.h (original)
+++ trunk/PCSC/src/PCSC/ifdhandler.h Tue Jun 22 09:28:35 2010
@@ -304,6 +304,7 @@
 #define TAG_IFD_SIMULTANEOUS_ACCESS     0x0FAF	/**< number of reader the driver can manage */
 #define TAG_IFD_POLLING_THREAD          0x0FB0	/**< driver uses a polling thread */
 #define TAG_IFD_POLLING_THREAD_KILLABLE 0x0FB1	/**< the polling thread can be killed */
+#define TAG_IFD_STOP_POLLING_THREAD     0x0FB2	/**< method used to stop the polling thread (instead of just pthread_kill() */
 
 	/*
 	 * IFD Handler version number enummerations

Modified: trunk/PCSC/src/eventhandler.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/eventhandler.c?rev=5029&op=diff
==============================================================================
--- trunk/PCSC/src/eventhandler.c (original)
+++ trunk/PCSC/src/eventhandler.c Tue Jun 22 09:28:35 2010
@@ -182,7 +182,22 @@
 	}
 	else
 #endif
-		Log1(PCSC_LOG_INFO, "Waiting polling thread");
+	{
+		/* ask to stop the "polling" thread */
+		RESPONSECODE (*fct)(DWORD) = NULL;
+
+		dwGetSize = sizeof(fct);
+		rv = IFDGetCapabilities(rContext, TAG_IFD_STOP_POLLING_THREAD,
+			&dwGetSize, (PUCHAR)&fct);
+
+		if ((IFD_SUCCESS == rv) && (dwGetSize == sizeof(fct)))
+		{
+			Log1(PCSC_LOG_INFO, "Request stoping of polling thread");
+			fct(rContext->slot);
+		}
+		else
+			Log1(PCSC_LOG_INFO, "Waiting polling thread");
+	}
 
 	/* wait for the thread to finish */
 	rv = pthread_join(rContext->pthThread, NULL);




More information about the Pcsclite-cvs-commit mailing list