[Pcsclite-cvs-commit] r3030 - /trunk/PCSC/src/eventhandler.c

rousseau at users.alioth.debian.org rousseau at users.alioth.debian.org
Thu Jun 26 14:00:01 UTC 2008


Author: rousseau
Date: Thu Jun 26 14:00:00 2008
New Revision: 3030

URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=3030
Log:
EHDestroyEventHandler(): kill the polling thread only if the driver
supports it (declared using TAG_IFD_POLLING_THREAD_KILLABLE)

libusb 1.0 does not support it so it is disabled in the ccid driver

Modified:
    trunk/PCSC/src/eventhandler.c

Modified: trunk/PCSC/src/eventhandler.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/eventhandler.c?rev=3030&op=diff
==============================================================================
--- trunk/PCSC/src/eventhandler.c (original)
+++ trunk/PCSC/src/eventhandler.c Thu Jun 26 14:00:00 2008
@@ -101,6 +101,8 @@
 LONG EHDestroyEventHandler(PREADER_CONTEXT rContext)
 {
 	int rv;
+	DWORD dwGetSize;
+	UCHAR ucGetData[1];
 
 	if (NULL == rContext->readerState)
 	{
@@ -122,7 +124,17 @@
 	Log1(PCSC_LOG_INFO, "Stomping thread.");
 
 	/* kill the "polling" thread */
-	SYS_ThreadCancel(rContext->pthThread);
+	dwGetSize = sizeof(ucGetData);
+	rv = IFDGetCapabilities(rContext, TAG_IFD_POLLING_THREAD_KILLABLE,
+		&dwGetSize, ucGetData);
+
+	if ((IFD_SUCCESS == rv) && (1 == dwGetSize) && ucGetData[0])
+	{
+		Log1(PCSC_LOG_INFO, "Killing polling thread");
+		SYS_ThreadCancel(rContext->pthThread);
+	}
+	else
+		Log1(PCSC_LOG_INFO, "Waiting polling thread");
 
 	/* wait for the thread to finish */
 	rv = SYS_ThreadJoin(rContext->pthThread, NULL);




More information about the Pcsclite-cvs-commit mailing list