[Pcsclite-cvs-commit] r4885 - in /trunk/PCSC/src: Makefile.am eventhandler.c hotplug_libhal.c hotplug_libusb.c hotplug_linux.c ifdwrapper.c pcscdaemon.c readerfactory.c readerfactory.h thread_generic.h thread_unix.c winscard.c winscard_clnt.c winscard_svc.c
rousseau at users.alioth.debian.org
rousseau at users.alioth.debian.org
Sun Apr 18 12:18:00 UTC 2010
Author: rousseau
Date: Sun Apr 18 12:17:56 2010
New Revision: 4885
URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=4885
Log:
Directly use pthread_mutex_* fucntions instead of using wrappers
Remove thread_unix.c and thread_generic.h now useless
Removed:
trunk/PCSC/src/thread_generic.h
trunk/PCSC/src/thread_unix.c
Modified:
trunk/PCSC/src/Makefile.am
trunk/PCSC/src/eventhandler.c
trunk/PCSC/src/hotplug_libhal.c
trunk/PCSC/src/hotplug_libusb.c
trunk/PCSC/src/hotplug_linux.c
trunk/PCSC/src/ifdwrapper.c
trunk/PCSC/src/pcscdaemon.c
trunk/PCSC/src/readerfactory.c
trunk/PCSC/src/readerfactory.h
trunk/PCSC/src/winscard.c
trunk/PCSC/src/winscard_clnt.c
trunk/PCSC/src/winscard_svc.c
Modified: trunk/PCSC/src/Makefile.am
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/Makefile.am?rev=4885&op=diff
==============================================================================
--- trunk/PCSC/src/Makefile.am (original)
+++ trunk/PCSC/src/Makefile.am Sun Apr 18 12:17:56 2010
@@ -16,7 +16,6 @@
strlcat.c \
strlcpy.c \
sys_unix.c \
- thread_unix.c \
utils.c \
winscard_msg.c
libpcsclite_la_LDFLAGS = -version-info 1:0:0
@@ -68,8 +67,6 @@
strlcpycat.h \
sys_generic.h \
sys_unix.c \
- thread_generic.h \
- thread_unix.c \
tokenparser.l \
utils.c \
utils.h \
Modified: trunk/PCSC/src/eventhandler.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/eventhandler.c?rev=4885&op=diff
==============================================================================
--- trunk/PCSC/src/eventhandler.c (original)
+++ trunk/PCSC/src/eventhandler.c Sun Apr 18 12:17:56 2010
@@ -22,12 +22,12 @@
#include <fcntl.h>
#include <string.h>
#include <stdlib.h>
+#include <pthread.h>
#include "misc.h"
#include "pcscd.h"
#include "ifdhandler.h"
#include "debuglog.h"
-#include "thread_generic.h"
#include "readerfactory.h"
#include "eventhandler.h"
#include "dyn_generic.h"
@@ -41,17 +41,17 @@
READER_STATE readerStates[PCSCLITE_MAX_READERS_CONTEXTS];
static list_t ClientsWaitingForEvent; /**< list of client file descriptors */
-PCSCLITE_MUTEX ClientsWaitingForEvent_lock; /**< lock for the above list */
+pthread_mutex_t ClientsWaitingForEvent_lock; /**< lock for the above list */
static void EHStatusHandlerThread(READER_CONTEXT *);
LONG EHRegisterClientForEvent(int32_t filedes)
{
- (void)SYS_MutexLock(&ClientsWaitingForEvent_lock);
+ (void)pthread_mutex_lock(&ClientsWaitingForEvent_lock);
(void)list_append(&ClientsWaitingForEvent, &filedes);
- (void)SYS_MutexUnLock(&ClientsWaitingForEvent_lock);
+ (void)pthread_mutex_unlock(&ClientsWaitingForEvent_lock);
return SCARD_S_SUCCESS;
} /* EHRegisterClientForEvent */
@@ -65,11 +65,11 @@
LONG rv = SCARD_S_SUCCESS;
int ret;
- (void)SYS_MutexLock(&ClientsWaitingForEvent_lock);
+ (void)pthread_mutex_lock(&ClientsWaitingForEvent_lock);
ret = list_delete(&ClientsWaitingForEvent, &filedes);
- (void)SYS_MutexUnLock(&ClientsWaitingForEvent_lock);
+ (void)pthread_mutex_unlock(&ClientsWaitingForEvent_lock);
if (ret < 0)
rv = SCARD_F_INTERNAL_ERROR;
@@ -98,7 +98,7 @@
LONG rv = SCARD_S_SUCCESS;
int32_t filedes;
- (void)SYS_MutexLock(&ClientsWaitingForEvent_lock);
+ (void)pthread_mutex_lock(&ClientsWaitingForEvent_lock);
(void)list_iterator_start(&ClientsWaitingForEvent);
while (list_iterator_hasnext(&ClientsWaitingForEvent))
@@ -110,7 +110,7 @@
(void)list_clear(&ClientsWaitingForEvent);
- (void)SYS_MutexUnLock(&ClientsWaitingForEvent_lock);
+ (void)pthread_mutex_unlock(&ClientsWaitingForEvent_lock);
return rv;
} /* EHSignalEventToClients */
@@ -139,7 +139,7 @@
/* setting the comparator, so the list can sort, find the min, max etc */
(void)list_attributes_comparator(&ClientsWaitingForEvent, list_comparator_int32_t);
- (void)SYS_MutexInit(&ClientsWaitingForEvent_lock);
+ (void)pthread_mutex_init(&ClientsWaitingForEvent_lock, NULL);
return SCARD_S_SUCCESS;
}
Modified: trunk/PCSC/src/hotplug_libhal.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/hotplug_libhal.c?rev=4885&op=diff
==============================================================================
--- trunk/PCSC/src/hotplug_libhal.c (original)
+++ trunk/PCSC/src/hotplug_libhal.c Sun Apr 18 12:17:56 2010
@@ -20,6 +20,7 @@
#include <dirent.h>
#include <stdlib.h>
#include <libhal.h>
+#include <pthread.h>
#include "misc.h"
#include "wintypes.h"
@@ -29,7 +30,6 @@
#include "readerfactory.h"
#include "sys_generic.h"
#include "hotplug.h"
-#include "thread_generic.h"
#include "utils.h"
#include "strlcpycat.h"
@@ -42,7 +42,7 @@
#define UDI_BASE "/org/freedesktop/Hal/devices/"
-PCSCLITE_MUTEX usbNotifierMutex;
+pthread_mutex_t usbNotifierMutex;
static pthread_t usbNotifyThread;
static int driverSize = -1;
@@ -374,7 +374,7 @@
/* wait until the device is visible by libusb/etc. */
(void)SYS_Sleep(1);
- (void)SYS_MutexLock(&usbNotifierMutex);
+ (void)pthread_mutex_lock(&usbNotifierMutex);
/* find a free entry */
for (i=0; i<PCSCLITE_MAX_READERS_CONTEXTS; i++)
@@ -387,7 +387,7 @@
{
Log2(PCSC_LOG_ERROR,
"Not enough reader entries. Already found %d readers", i);
- (void)SYS_MutexUnLock(&usbNotifierMutex);
+ (void)pthread_mutex_unlock(&usbNotifierMutex);
return;
}
@@ -479,7 +479,7 @@
}
}
- (void)SYS_MutexUnLock(&usbNotifierMutex);
+ (void)pthread_mutex_unlock(&usbNotifierMutex);
} /* HPAddDevice */
@@ -503,7 +503,7 @@
Log3(PCSC_LOG_INFO, "Removing USB device[%d]: %s", i,
short_name(readerTracker[i].udi));
- (void)SYS_MutexLock(&usbNotifierMutex);
+ (void)pthread_mutex_lock(&usbNotifierMutex);
(void)RFRemoveReader(readerTracker[i].fullName, PCSCLITE_HP_BASE_PORT + i);
free(readerTracker[i].fullName);
@@ -511,7 +511,7 @@
free(readerTracker[i].udi);
readerTracker[i].udi = NULL;
- (void)SYS_MutexUnLock(&usbNotifierMutex);
+ (void)pthread_mutex_unlock(&usbNotifierMutex);
return;
} /* HPRemoveDevice */
@@ -526,7 +526,7 @@
int i, num_devices;
DBusError error;
- (void)SYS_MutexInit(&usbNotifierMutex);
+ (void)pthread_mutex_init(&usbNotifierMutex, NULL);
if (driverSize <= 0)
{
Modified: trunk/PCSC/src/hotplug_libusb.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/hotplug_libusb.c?rev=4885&op=diff
==============================================================================
--- trunk/PCSC/src/hotplug_libusb.c (original)
+++ trunk/PCSC/src/hotplug_libusb.c Sun Apr 18 12:17:56 2010
@@ -31,6 +31,7 @@
#include <unistd.h>
#include <errno.h>
#include <usb.h>
+#include <pthread.h>
#include "misc.h"
#include "wintypes.h"
@@ -55,7 +56,7 @@
#define FALSE 0
#define TRUE 1
-PCSCLITE_MUTEX usbNotifierMutex;
+pthread_mutex_t usbNotifierMutex;
static pthread_t usbNotifyThread;
static int driverSize = -1;
@@ -483,7 +484,7 @@
dev->descriptor.idVendor, dev->descriptor.idProduct, bus_device);
deviceName[sizeof(deviceName) -1] = '\0';
- SYS_MutexLock(&usbNotifierMutex);
+ pthread_mutex_lock(&usbNotifierMutex);
/* find a free entry */
for (i=0; i<PCSCLITE_MAX_READERS_CONTEXTS; i++)
@@ -496,7 +497,7 @@
{
Log2(PCSC_LOG_ERROR,
"Not enough reader entries. Already found %d readers", i);
- SYS_MutexUnLock(&usbNotifierMutex);
+ pthread_mutex_unlock(&usbNotifierMutex);
return 0;
}
@@ -544,14 +545,14 @@
(void)CheckForOpenCT();
}
- SYS_MutexUnLock(&usbNotifierMutex);
+ pthread_mutex_unlock(&usbNotifierMutex);
return 1;
} /* End of function */
static LONG HPRemoveHotPluggable(int reader_index)
{
- SYS_MutexLock(&usbNotifierMutex);
+ pthread_mutex_lock(&usbNotifierMutex);
Log3(PCSC_LOG_INFO, "Removing USB device[%d]: %s", reader_index,
readerTracker[reader_index].bus_device);
@@ -563,7 +564,7 @@
readerTracker[reader_index].bus_device[0] = '\0';
readerTracker[reader_index].fullName = NULL;
- SYS_MutexUnLock(&usbNotifierMutex);
+ pthread_mutex_unlock(&usbNotifierMutex);
return 1;
} /* End of function */
@@ -573,7 +574,7 @@
*/
ULONG HPRegisterForHotplugEvents(void)
{
- (void)SYS_MutexInit(&usbNotifierMutex);
+ (void)pthread_mutex_init(&usbNotifierMutex, NULL);
return 0;
}
Modified: trunk/PCSC/src/hotplug_linux.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/hotplug_linux.c?rev=4885&op=diff
==============================================================================
--- trunk/PCSC/src/hotplug_linux.c (original)
+++ trunk/PCSC/src/hotplug_linux.c Sun Apr 18 12:17:56 2010
@@ -44,7 +44,7 @@
#define FALSE 0
#define TRUE 1
-PCSCLITE_MUTEX usbNotifierMutex;
+pthread_mutex_t usbNotifierMutex;
struct usb_device_descriptor
{
@@ -314,7 +314,7 @@
if (usbDeviceStatus == 1)
{
- SYS_MutexLock(&usbNotifierMutex);
+ pthread_mutex_lock(&usbNotifierMutex);
for (j=0; j < PCSCLITE_MAX_READERS_CONTEXTS; j++)
{
@@ -331,7 +331,7 @@
bundleTracker[i].deviceNumber[j].id = suspectDeviceNumber;
}
- SYS_MutexUnLock(&usbNotifierMutex);
+ pthread_mutex_unlock(&usbNotifierMutex);
}
else
if (usbDeviceStatus == 0)
@@ -342,10 +342,10 @@
if (bundleTracker[i].deviceNumber[j].id != 0 &&
bundleTracker[i].deviceNumber[j].status == 0)
{
- SYS_MutexLock(&usbNotifierMutex);
+ pthread_mutex_lock(&usbNotifierMutex);
HPRemoveHotPluggable(i, j+1);
bundleTracker[i].deviceNumber[j].id = 0;
- SYS_MutexUnLock(&usbNotifierMutex);
+ pthread_mutex_unlock(&usbNotifierMutex);
}
}
}
@@ -423,7 +423,7 @@
*/
ULONG HPRegisterForHotplugEvents(void)
{
- (void)SYS_MutexInit(&usbNotifierMutex);
+ (void)pthread_mutex_init(&usbNotifierMutex, NULL);
return 0;
}
Modified: trunk/PCSC/src/ifdwrapper.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/ifdwrapper.c?rev=4885&op=diff
==============================================================================
--- trunk/PCSC/src/ifdwrapper.c (original)
+++ trunk/PCSC/src/ifdwrapper.c Sun Apr 18 12:17:56 2010
@@ -18,6 +18,8 @@
#include <errno.h>
#include <unistd.h>
+#include <pthread.h>
+
#include "config.h"
#include "misc.h"
#include "pcscd.h"
@@ -133,7 +135,7 @@
#endif
/* LOCK THIS CODE REGION */
- (void)SYS_MutexLock(rContext->mMutex);
+ (void)pthread_mutex_lock(rContext->mMutex);
#ifndef PCSCLITE_STATIC_DRIVER
if (rContext->version == IFD_HVERSION_1_0)
@@ -167,7 +169,7 @@
#endif
/* END OF LOCKED REGION */
- (void)SYS_MutexUnLock(rContext->mMutex);
+ (void)pthread_mutex_unlock(rContext->mMutex);
return rv;
}
@@ -193,7 +195,7 @@
/* TRY TO LOCK THIS CODE REGION */
repeat = 5;
again:
- rv = SYS_MutexTryLock(rContext->mMutex);
+ rv = pthread_mutex_trylock(rContext->mMutex);
if (EBUSY == rv)
{
Log1(PCSC_LOG_ERROR, "Locking failed");
@@ -220,7 +222,7 @@
#endif
/* END OF LOCKED REGION */
- (void)SYS_MutexUnLock(rContext->mMutex);
+ (void)pthread_mutex_unlock(rContext->mMutex);
return rv;
}
@@ -288,7 +290,7 @@
#endif
/* LOCK THIS CODE REGION */
- (void)SYS_MutexLock(rContext->mMutex);
+ (void)pthread_mutex_lock(rContext->mMutex);
#ifndef PCSCLITE_STATIC_DRIVER
if (rContext->version == IFD_HVERSION_1_0)
@@ -305,7 +307,7 @@
#endif
/* END OF LOCKED REGION */
- (void)SYS_MutexUnLock(rContext->mMutex);
+ (void)pthread_mutex_unlock(rContext->mMutex);
return rv;
}
@@ -351,7 +353,7 @@
#endif
/* LOCK THIS CODE REGION */
- (void)SYS_MutexLock(rContext->mMutex);
+ (void)pthread_mutex_lock(rContext->mMutex);
#ifndef PCSCLITE_STATIC_DRIVER
if (rContext->version == IFD_HVERSION_1_0)
@@ -380,7 +382,7 @@
#endif
/* END OF LOCKED REGION */
- (void)SYS_MutexUnLock(rContext->mMutex);
+ (void)pthread_mutex_unlock(rContext->mMutex);
/* use clean values in case of error */
if (rv != IFD_SUCCESS)
@@ -435,7 +437,7 @@
#endif
/* LOCK THIS CODE REGION */
- (void)SYS_MutexLock(rContext->mMutex);
+ (void)pthread_mutex_lock(rContext->mMutex);
#ifndef PCSCLITE_STATIC_DRIVER
if (rContext->version == IFD_HVERSION_1_0)
@@ -459,7 +461,7 @@
#endif
/* END OF LOCKED REGION */
- (void)SYS_MutexUnLock(rContext->mMutex);
+ (void)pthread_mutex_unlock(rContext->mMutex);
if (rv == IFD_SUCCESS || rv == IFD_ICC_PRESENT)
dwCardStatus |= SCARD_PRESENT;
@@ -495,7 +497,7 @@
dwTag = TAG_IFD_ATR;
/* LOCK THIS CODE REGION */
- (void)SYS_MutexLock(rContext->mMutex);
+ (void)pthread_mutex_lock(rContext->mMutex);
ucValue[0] = rContext->slot;
(void)IFDSetCapabilities(rContext, TAG_IFD_SLOTNUM, 1, ucValue);
@@ -509,7 +511,7 @@
#endif
/* END OF LOCKED REGION */
- (void)SYS_MutexUnLock(rContext->mMutex);
+ (void)pthread_mutex_unlock(rContext->mMutex);
/*
* FIX :: This is a temporary way to return the correct size
@@ -571,7 +573,7 @@
#endif
/* LOCK THIS CODE REGION */
- (void)SYS_MutexLock(rContext->mMutex);
+ (void)pthread_mutex_lock(rContext->mMutex);
#ifndef PCSCLITE_STATIC_DRIVER
rv = (*IFDH_control_v2) (rContext->slot, TxBuffer, TxLength,
@@ -582,7 +584,7 @@
#endif
/* END OF LOCKED REGION */
- (void)SYS_MutexUnLock(rContext->mMutex);
+ (void)pthread_mutex_unlock(rContext->mMutex);
if (rv == IFD_SUCCESS)
return SCARD_S_SUCCESS;
@@ -622,7 +624,7 @@
#endif
/* LOCK THIS CODE REGION */
- (void)SYS_MutexLock(rContext->mMutex);
+ (void)pthread_mutex_lock(rContext->mMutex);
#ifndef PCSCLITE_STATIC_DRIVER
rv = (*IFDH_control) (rContext->slot, ControlCode, TxBuffer,
@@ -633,7 +635,7 @@
#endif
/* END OF LOCKED REGION */
- (void)SYS_MutexUnLock(rContext->mMutex);
+ (void)pthread_mutex_unlock(rContext->mMutex);
if (rv == IFD_SUCCESS)
return SCARD_S_SUCCESS;
@@ -690,7 +692,7 @@
#endif
/* LOCK THIS CODE REGION */
- (void)SYS_MutexLock(rContext->mMutex);
+ (void)pthread_mutex_lock(rContext->mMutex);
#ifndef PCSCLITE_STATIC_DRIVER
if (rContext->version == IFD_HVERSION_1_0)
@@ -724,7 +726,7 @@
#endif
/* END OF LOCKED REGION */
- (void)SYS_MutexUnLock(rContext->mMutex);
+ (void)pthread_mutex_unlock(rContext->mMutex);
/* log the returned status word */
DebugLogCategory(DEBUG_CATEGORY_SW, pucRxBuffer, *pdwRxLength);
Modified: trunk/PCSC/src/pcscdaemon.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/pcscdaemon.c?rev=4885&op=diff
==============================================================================
--- trunk/PCSC/src/pcscdaemon.c (original)
+++ trunk/PCSC/src/pcscdaemon.c Sun Apr 18 12:17:56 2010
@@ -40,7 +40,6 @@
#include "winscard_msg.h"
#include "winscard_svc.h"
#include "sys_generic.h"
-#include "thread_generic.h"
#include "hotplug.h"
#include "readerfactory.h"
#include "configfile.h"
Modified: trunk/PCSC/src/readerfactory.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/readerfactory.c?rev=4885&op=diff
==============================================================================
--- trunk/PCSC/src/readerfactory.c (original)
+++ trunk/PCSC/src/readerfactory.c Sun Apr 18 12:17:56 2010
@@ -27,12 +27,12 @@
#include <sys/stat.h>
#include <errno.h>
#include <fcntl.h>
+#include <pthread.h>
#include "misc.h"
#include "pcscd.h"
#include "ifdhandler.h"
#include "debuglog.h"
-#include "thread_generic.h"
#include "readerfactory.h"
#include "dyn_generic.h"
#include "sys_generic.h"
@@ -53,7 +53,7 @@
static DWORD dwNumReadersContexts = 0;
static char *ConfigFile = NULL;
static int ConfigFileCRC = 0;
-static PCSCLITE_MUTEX LockMutex = PTHREAD_MUTEX_INITIALIZER;
+static pthread_mutex_t LockMutex = PTHREAD_MUTEX_INITIALIZER;
#define IDENTITY_SHIFT 16
@@ -191,7 +191,8 @@
return SCARD_E_NO_MEMORY;
}
- (void)SYS_MutexInit(&(sReadersContexts[dwContext])->handlesList_lock);
+ (void)pthread_mutex_init(&(sReadersContexts[dwContext])->handlesList_lock,
+ NULL);
/* If a clone to this reader exists take some values from that clone */
if (parentNode >= 0 && parentNode < PCSCLITE_MAX_READERS_CONTEXTS)
@@ -235,8 +236,8 @@
if ((sReadersContexts[dwContext])->mMutex == 0)
{
(sReadersContexts[dwContext])->mMutex =
- malloc(sizeof(PCSCLITE_MUTEX));
- (void)SYS_MutexInit((sReadersContexts[dwContext])->mMutex);
+ malloc(sizeof(pthread_mutex_t));
+ (void)pthread_mutex_init((sReadersContexts[dwContext])->mMutex, NULL);
}
if ((sReadersContexts[dwContext])->pMutex == NULL)
@@ -380,7 +381,7 @@
return SCARD_E_NO_MEMORY;
}
- (void)SYS_MutexInit(&(sReadersContexts[dwContextB])->handlesList_lock);
+ (void)pthread_mutex_init(&(sReadersContexts[dwContextB])->handlesList_lock, NULL);
/* Call on the parent driver to see if the slots are thread safe */
dwGetSize = sizeof(ucThread);
@@ -390,8 +391,9 @@
if (rv == IFD_SUCCESS && dwGetSize == 1 && ucThread[0] == 1)
{
(sReadersContexts[dwContextB])->mMutex =
- malloc(sizeof(PCSCLITE_MUTEX));
- (void)SYS_MutexInit((sReadersContexts[dwContextB])->mMutex);
+ malloc(sizeof(pthread_mutex_t));
+ (void)pthread_mutex_init((sReadersContexts[dwContextB])->mMutex,
+ NULL);
(sReadersContexts[dwContextB])->pMutex = malloc(sizeof(int));
*(sReadersContexts[dwContextB])->pMutex = 1;
@@ -466,7 +468,7 @@
/* free shared resources when the last slot is closed */
if (0 == *sContext->pMutex)
{
- (void)SYS_MutexDestroy(sContext->mMutex);
+ (void)pthread_mutex_destroy(sContext->mMutex);
free(sContext->mMutex);
free(sContext->lpcLibrary);
free(sContext->lpcDevice);
@@ -494,7 +496,7 @@
sContext->dwIdentity = 0;
sContext->readerState = NULL;
- (void)SYS_MutexLock(&sContext->handlesList_lock);
+ (void)pthread_mutex_lock(&sContext->handlesList_lock);
while (list_size(&(sContext->handlesList)) != 0)
{
int lrv;
@@ -508,7 +510,7 @@
free(currentHandle);
}
- (void)SYS_MutexUnLock(&sContext->handlesList_lock);
+ (void)pthread_mutex_unlock(&sContext->handlesList_lock);
list_destroy(&(sContext->handlesList));
dwNumReadersContexts -= 1;
@@ -911,14 +913,14 @@
(void)RFReaderInfoById(hCard, &rContext);
- (void)SYS_MutexLock(&LockMutex);
+ (void)pthread_mutex_lock(&LockMutex);
rv = RFCheckSharing(hCard);
if (SCARD_S_SUCCESS == rv)
{
rContext->LockCount += 1;
rContext->hLockId = hCard;
}
- (void)SYS_MutexUnLock(&LockMutex);
+ (void)pthread_mutex_unlock(&LockMutex);
return rv;
}
@@ -932,7 +934,7 @@
if (rv != SCARD_S_SUCCESS)
return rv;
- (void)SYS_MutexLock(&LockMutex);
+ (void)pthread_mutex_lock(&LockMutex);
rv = RFCheckSharing(hCard);
if (SCARD_S_SUCCESS == rv)
{
@@ -941,7 +943,7 @@
if (0 == rContext->LockCount)
rContext->hLockId = 0;
}
- (void)SYS_MutexUnLock(&LockMutex);
+ (void)pthread_mutex_unlock(&LockMutex);
return rv;
}
@@ -955,14 +957,14 @@
if (rv != SCARD_S_SUCCESS)
return rv;
- (void)SYS_MutexLock(&LockMutex);
+ (void)pthread_mutex_lock(&LockMutex);
rv = RFCheckSharing(hCard);
if (SCARD_S_SUCCESS == rv)
{
rContext->LockCount = 0;
rContext->hLockId = 0;
}
- (void)SYS_MutexUnLock(&LockMutex);
+ (void)pthread_mutex_unlock(&LockMutex);
return rv;
}
@@ -1056,7 +1058,7 @@
RDR_CLIHANDLES *currentHandle;
list_t * l = &((sReadersContexts[i])->handlesList);
- (void)SYS_MutexLock(&(sReadersContexts[i])->handlesList_lock);
+ (void)pthread_mutex_lock(&(sReadersContexts[i])->handlesList_lock);
list_iterator_start(l);
while (list_iterator_hasnext(l))
{
@@ -1067,12 +1069,12 @@
/* Get a new handle and loop again */
randHandle = SYS_RandomInt(10, 65000);
list_iterator_stop(l);
- (void)SYS_MutexUnLock(&(sReadersContexts[i])->handlesList_lock);
+ (void)pthread_mutex_unlock(&(sReadersContexts[i])->handlesList_lock);
goto again;
}
}
list_iterator_stop(l);
- (void)SYS_MutexUnLock(&(sReadersContexts[i])->handlesList_lock);
+ (void)pthread_mutex_unlock(&(sReadersContexts[i])->handlesList_lock);
}
}
@@ -1090,10 +1092,10 @@
if ((sReadersContexts[i])->vHandle != 0)
{
RDR_CLIHANDLES * currentHandle;
- (void)SYS_MutexLock(&(sReadersContexts[i])->handlesList_lock);
+ (void)pthread_mutex_lock(&(sReadersContexts[i])->handlesList_lock);
currentHandle = list_seek(&((sReadersContexts[i])->handlesList),
&hCard);
- (void)SYS_MutexUnLock(&(sReadersContexts[i])->handlesList_lock);
+ (void)pthread_mutex_unlock(&(sReadersContexts[i])->handlesList_lock);
if (currentHandle != NULL)
return SCARD_S_SUCCESS;
}
@@ -1114,7 +1116,7 @@
RDR_CLIHANDLES *newHandle;
LONG rv = SCARD_S_SUCCESS;
- (void)SYS_MutexLock(&rContext->handlesList_lock);
+ (void)pthread_mutex_lock(&rContext->handlesList_lock);
listLength = list_size(&(rContext->handlesList));
/* Throttle the number of possible handles */
@@ -1147,7 +1149,7 @@
rv = SCARD_E_NO_MEMORY;
}
end:
- (void)SYS_MutexUnLock(&rContext->handlesList_lock);
+ (void)pthread_mutex_unlock(&rContext->handlesList_lock);
return SCARD_S_SUCCESS;
}
@@ -1157,7 +1159,7 @@
int lrv;
LONG rv = SCARD_S_SUCCESS;
- (void)SYS_MutexLock(&rContext->handlesList_lock);
+ (void)pthread_mutex_lock(&rContext->handlesList_lock);
currentHandle = list_seek(&(rContext->handlesList), &hCard);
if (NULL == currentHandle)
{
@@ -1174,7 +1176,7 @@
free(currentHandle);
end:
- (void)SYS_MutexUnLock(&rContext->handlesList_lock);
+ (void)pthread_mutex_unlock(&rContext->handlesList_lock);
/* Not Found */
return rv;
@@ -1186,7 +1188,7 @@
int list_index, listSize;
RDR_CLIHANDLES *currentHandle;
- (void)SYS_MutexLock(&rContext->handlesList_lock);
+ (void)pthread_mutex_lock(&rContext->handlesList_lock);
listSize = list_size(&(rContext->handlesList));
for (list_index = 0; list_index < listSize; list_index++)
@@ -1201,7 +1203,7 @@
currentHandle->dwEventStatus = dwEvent;
}
- (void)SYS_MutexUnLock(&rContext->handlesList_lock);
+ (void)pthread_mutex_unlock(&rContext->handlesList_lock);
if (SCARD_REMOVED == dwEvent)
{
@@ -1218,9 +1220,9 @@
LONG rv;
RDR_CLIHANDLES *currentHandle;
- (void)SYS_MutexLock(&rContext->handlesList_lock);
+ (void)pthread_mutex_lock(&rContext->handlesList_lock);
currentHandle = list_seek(&(rContext->handlesList), &hCard);
- (void)SYS_MutexUnLock(&rContext->handlesList_lock);
+ (void)pthread_mutex_unlock(&rContext->handlesList_lock);
if (NULL == currentHandle)
{
/* Not Found */
@@ -1253,9 +1255,9 @@
{
RDR_CLIHANDLES *currentHandle;
- (void)SYS_MutexLock(&rContext->handlesList_lock);
+ (void)pthread_mutex_lock(&rContext->handlesList_lock);
currentHandle = list_seek(&(rContext->handlesList), &hCard);
- (void)SYS_MutexUnLock(&rContext->handlesList_lock);
+ (void)pthread_mutex_unlock(&rContext->handlesList_lock);
if (NULL == currentHandle)
/* Not Found */
return SCARD_E_INVALID_HANDLE;
Modified: trunk/PCSC/src/readerfactory.h
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/readerfactory.h?rev=4885&op=diff
==============================================================================
--- trunk/PCSC/src/readerfactory.h (original)
+++ trunk/PCSC/src/readerfactory.h Sun Apr 18 12:17:56 2010
@@ -19,7 +19,6 @@
#include <inttypes.h>
-#include "thread_generic.h"
#include "ifdhandler.h"
#include "pcscd.h"
#include "simclist.h"
@@ -110,9 +109,9 @@
char *lpcDevice; /**< Device Name */
pthread_t pthThread; /**< Event polling thread */
RESPONSECODE (*pthCardEvent)(DWORD); /**< Card Event sync */
- PCSCLITE_MUTEX *mMutex; /**< Mutex for this connection */
+ pthread_mutex_t *mMutex; /**< Mutex for this connection */
list_t handlesList;
- PCSCLITE_MUTEX handlesList_lock; /**< lock for the above list */
+ pthread_mutex_t handlesList_lock; /**< lock for the above list */
/**< Structure of connected handles */
union
{
Modified: trunk/PCSC/src/winscard.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/winscard.c?rev=4885&op=diff
==============================================================================
--- trunk/PCSC/src/winscard.c (original)
+++ trunk/PCSC/src/winscard.c Sun Apr 18 12:17:56 2010
@@ -83,6 +83,7 @@
#include <stdlib.h>
#include <sys/time.h>
#include <string.h>
+#include <pthread.h>
#include "pcscd.h"
#include "winscard.h"
@@ -360,7 +361,7 @@
{
/* lock here instead in IFDSetPTS() to lock up to
* setting rContext->readerState->cardProtocol */
- (void)SYS_MutexLock(rContext->mMutex);
+ (void)pthread_mutex_lock(rContext->mMutex);
/* the protocol is not yet set (no PPS yet) */
if (SCARD_PROTOCOL_UNDEFINED == rContext->readerState->cardProtocol)
@@ -386,24 +387,24 @@
/* keep cardProtocol = SCARD_PROTOCOL_UNDEFINED in case of error */
if (SET_PROTOCOL_PPS_FAILED == ret)
{
- (void)SYS_MutexUnLock(rContext->mMutex);
+ (void)pthread_mutex_unlock(rContext->mMutex);
return SCARD_W_UNRESPONSIVE_CARD;
}
if (SET_PROTOCOL_WRONG_ARGUMENT == ret)
{
- (void)SYS_MutexUnLock(rContext->mMutex);
+ (void)pthread_mutex_unlock(rContext->mMutex);
return SCARD_E_PROTO_MISMATCH;
}
/* use negotiated protocol */
rContext->readerState->cardProtocol = ret;
- (void)SYS_MutexUnLock(rContext->mMutex);
+ (void)pthread_mutex_unlock(rContext->mMutex);
}
else
{
- (void)SYS_MutexUnLock(rContext->mMutex);
+ (void)pthread_mutex_unlock(rContext->mMutex);
if (! (dwPreferredProtocols & rContext->readerState->cardProtocol))
return SCARD_E_PROTO_MISMATCH;
@@ -663,7 +664,7 @@
{
/* lock here instead in IFDSetPTS() to lock up to
* setting rContext->readerState->cardProtocol */
- (void)SYS_MutexLock(rContext->mMutex);
+ (void)pthread_mutex_lock(rContext->mMutex);
/* the protocol is not yet set (no PPS yet) */
if (SCARD_PROTOCOL_UNDEFINED == rContext->readerState->cardProtocol)
@@ -687,24 +688,24 @@
/* keep cardProtocol = SCARD_PROTOCOL_UNDEFINED in case of error */
if (SET_PROTOCOL_PPS_FAILED == ret)
{
- (void)SYS_MutexUnLock(rContext->mMutex);
+ (void)pthread_mutex_unlock(rContext->mMutex);
return SCARD_W_UNRESPONSIVE_CARD;
}
if (SET_PROTOCOL_WRONG_ARGUMENT == ret)
{
- (void)SYS_MutexUnLock(rContext->mMutex);
+ (void)pthread_mutex_unlock(rContext->mMutex);
return SCARD_E_PROTO_MISMATCH;
}
/* use negotiated protocol */
rContext->readerState->cardProtocol = ret;
- (void)SYS_MutexUnLock(rContext->mMutex);
+ (void)pthread_mutex_unlock(rContext->mMutex);
}
else
{
- (void)SYS_MutexUnLock(rContext->mMutex);
+ (void)pthread_mutex_unlock(rContext->mMutex);
if (! (dwPreferredProtocols & rContext->readerState->cardProtocol))
return SCARD_E_PROTO_MISMATCH;
Modified: trunk/PCSC/src/winscard_clnt.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/winscard_clnt.c?rev=4885&op=diff
==============================================================================
--- trunk/PCSC/src/winscard_clnt.c (original)
+++ trunk/PCSC/src/winscard_clnt.c Sun Apr 18 12:17:56 2010
@@ -85,12 +85,12 @@
#include <errno.h>
#include <stddef.h>
#include <sys/time.h>
+#include <pthread.h>
#include "misc.h"
#include "pcscd.h"
#include "winscard.h"
#include "debuglog.h"
-#include "thread_generic.h"
#include "strlcpycat.h"
#include "readerfactory.h"
@@ -236,7 +236,7 @@
{
DWORD dwClientID; /**< Client Connection ID */
SCARDCONTEXT hContext; /**< Application Context ID */
- PCSCLITE_MUTEX * mMutex; /**< Mutex for this context */
+ pthread_mutex_t * mMutex; /**< Mutex for this context */
list_t channelMapList;
};
typedef struct _psContextMap SCONTEXTMAP;
@@ -281,7 +281,7 @@
* Ensure that some functions be accessed in thread-safe mode.
* These function's names finishes with "TH".
*/
-static PCSCLITE_MUTEX clientMutex = PTHREAD_MUTEX_INITIALIZER;
+static pthread_mutex_t clientMutex = PTHREAD_MUTEX_INITIALIZER;
/**
* Area used to read status information about the readers.
@@ -329,21 +329,21 @@
* @brief This function locks a mutex so another thread must wait to use this
* function.
*
- * Wrapper to the function SYS_MutexLock().
+ * Wrapper to the function pthread_mutex_lock().
*/
inline static LONG SCardLockThread(void)
{
- return SYS_MutexLock(&clientMutex);
+ return pthread_mutex_lock(&clientMutex);
}
/**
* @brief This function unlocks a mutex so another thread may use the client.
*
- * Wrapper to the function SYS_MutexUnLock().
+ * Wrapper to the function pthread_mutex_unlock().
*/
inline static LONG SCardUnlockThread(void)
{
- return SYS_MutexUnLock(&clientMutex);
+ return pthread_mutex_unlock(&clientMutex);
}
static LONG SCardEstablishContextTH(DWORD, LPCVOID, LPCVOID,
@@ -664,7 +664,7 @@
return SCARD_E_INVALID_HANDLE;
}
- (void)SYS_MutexLock(currentContextMap->mMutex);
+ (void)pthread_mutex_lock(currentContextMap->mMutex);
/* check the context is still opened */
currentContextMap = SCardGetContext(hContext);
@@ -703,7 +703,7 @@
rv = scReleaseStruct.rv;
end:
- (void)SYS_MutexUnLock(currentContextMap->mMutex);
+ (void)pthread_mutex_unlock(currentContextMap->mMutex);
/*
* Remove the local context from the stack
@@ -836,7 +836,7 @@
if (NULL == currentContextMap)
return SCARD_E_INVALID_HANDLE;
- (void)SYS_MutexLock(currentContextMap->mMutex);
+ (void)pthread_mutex_lock(currentContextMap->mMutex);
/* check the context is still opened */
currentContextMap = SCardGetContext(hContext);
@@ -892,7 +892,7 @@
rv = scConnectStruct.rv;
end:
- (void)SYS_MutexUnLock(currentContextMap->mMutex);
+ (void)pthread_mutex_unlock(currentContextMap->mMutex);
PROFILE_END(rv)
@@ -996,7 +996,7 @@
if (rv == -1)
return SCARD_E_INVALID_HANDLE;
- (void)SYS_MutexLock(currentContextMap->mMutex);
+ (void)pthread_mutex_lock(currentContextMap->mMutex);
/* check the handle is still valid */
rv = SCardGetContextAndChannelFromHandle(hCard, ¤tContextMap,
@@ -1053,7 +1053,7 @@
*pdwActiveProtocol = scReconnectStruct.dwActiveProtocol;
end:
- (void)SYS_MutexUnLock(currentContextMap->mMutex);
+ (void)pthread_mutex_unlock(currentContextMap->mMutex);
PROFILE_END(rv)
@@ -1110,7 +1110,7 @@
if (rv == -1)
return SCARD_E_INVALID_HANDLE;
- (void)SYS_MutexLock(currentContextMap->mMutex);
+ (void)pthread_mutex_lock(currentContextMap->mMutex);
/* check the handle is still valid */
rv = SCardGetContextAndChannelFromHandle(hCard, ¤tContextMap,
@@ -1154,7 +1154,7 @@
rv = scDisconnectStruct.rv;
end:
- (void)SYS_MutexUnLock(currentContextMap->mMutex);
+ (void)pthread_mutex_unlock(currentContextMap->mMutex);
PROFILE_END(rv)
@@ -1216,7 +1216,7 @@
if (rv == -1)
return SCARD_E_INVALID_HANDLE;
- (void)SYS_MutexLock(currentContextMap->mMutex);
+ (void)pthread_mutex_lock(currentContextMap->mMutex);
/* check the handle is still valid */
rv = SCardGetContextAndChannelFromHandle(hCard, ¤tContextMap,
@@ -1266,7 +1266,7 @@
while (SCARD_E_SHARING_VIOLATION == rv);
end:
- (void)SYS_MutexUnLock(currentContextMap->mMutex);
+ (void)pthread_mutex_unlock(currentContextMap->mMutex);
PROFILE_END(rv);
@@ -1338,7 +1338,7 @@
if (rv == -1)
return SCARD_E_INVALID_HANDLE;
- (void)SYS_MutexLock(currentContextMap->mMutex);
+ (void)pthread_mutex_lock(currentContextMap->mMutex);
/* check the handle is still valid */
rv = SCardGetContextAndChannelFromHandle(hCard, ¤tContextMap,
@@ -1385,7 +1385,7 @@
rv = scEndStruct.rv;
end:
- (void)SYS_MutexUnLock(currentContextMap->mMutex);
+ (void)pthread_mutex_unlock(currentContextMap->mMutex);
PROFILE_END(rv)
@@ -1417,7 +1417,7 @@
if (rv == -1)
return SCARD_E_INVALID_HANDLE;
- (void)SYS_MutexLock(currentContextMap->mMutex);
+ (void)pthread_mutex_lock(currentContextMap->mMutex);
/* check the handle is still valid */
rv = SCardGetContextAndChannelFromHandle(hCard, ¤tContextMap,
@@ -1456,7 +1456,7 @@
rv = scCancelStruct.rv;
end:
- (void)SYS_MutexUnLock(currentContextMap->mMutex);
+ (void)pthread_mutex_unlock(currentContextMap->mMutex);
PROFILE_END(rv)
@@ -1600,7 +1600,7 @@
if (rv == -1)
return SCARD_E_INVALID_HANDLE;
- (void)SYS_MutexLock(currentContextMap->mMutex);
+ (void)pthread_mutex_lock(currentContextMap->mMutex);
/* check the handle is still valid */
rv = SCardGetContextAndChannelFromHandle(hCard, ¤tContextMap,
@@ -1751,7 +1751,7 @@
}
end:
- (void)SYS_MutexUnLock(currentContextMap->mMutex);
+ (void)pthread_mutex_unlock(currentContextMap->mMutex);
PROFILE_END(rv)
@@ -1903,7 +1903,7 @@
if (NULL == currentContextMap)
return SCARD_E_INVALID_HANDLE;
- (void)SYS_MutexLock(currentContextMap->mMutex);
+ (void)pthread_mutex_lock(currentContextMap->mMutex);
/* check the context is still opened */
currentContextMap = SCardGetContext(hContext);
@@ -2309,7 +2309,7 @@
end:
Log1(PCSC_LOG_DEBUG, "Event Loop End");
- (void)SYS_MutexUnLock(currentContextMap->mMutex);
+ (void)pthread_mutex_unlock(currentContextMap->mMutex);
PROFILE_END(rv)
@@ -2397,7 +2397,7 @@
return SCARD_E_INVALID_HANDLE;
}
- (void)SYS_MutexLock(currentContextMap->mMutex);
+ (void)pthread_mutex_lock(currentContextMap->mMutex);
/* check the handle is still valid */
rv = SCardGetContextAndChannelFromHandle(hCard, ¤tContextMap,
@@ -2474,7 +2474,7 @@
rv = scControlStruct.rv;
end:
- (void)SYS_MutexUnLock(currentContextMap->mMutex);
+ (void)pthread_mutex_unlock(currentContextMap->mMutex);
PROFILE_END(rv)
@@ -2697,7 +2697,7 @@
if (rv == -1)
return SCARD_E_INVALID_HANDLE;
- (void)SYS_MutexLock(currentContextMap->mMutex);
+ (void)pthread_mutex_lock(currentContextMap->mMutex);
/* check the handle is still valid */
rv = SCardGetContextAndChannelFromHandle(hCard, ¤tContextMap,
@@ -2766,7 +2766,7 @@
rv = scGetSetStruct.rv;
end:
- (void)SYS_MutexUnLock(currentContextMap->mMutex);
+ (void)pthread_mutex_unlock(currentContextMap->mMutex);
return rv;
}
@@ -2859,7 +2859,7 @@
return SCARD_E_INVALID_HANDLE;
}
- (void)SYS_MutexLock(currentContextMap->mMutex);
+ (void)pthread_mutex_lock(currentContextMap->mMutex);
/* check the handle is still valid */
rv = SCardGetContextAndChannelFromHandle(hCard, ¤tContextMap,
@@ -2962,7 +2962,7 @@
*pcbRecvLength = scTransmitStruct.pcbRecvLength;
end:
- (void)SYS_MutexUnLock(currentContextMap->mMutex);
+ (void)pthread_mutex_unlock(currentContextMap->mMutex);
PROFILE_END(rv)
@@ -3049,7 +3049,7 @@
return SCARD_E_INVALID_HANDLE;
}
- (void)SYS_MutexLock(currentContextMap->mMutex);
+ (void)pthread_mutex_lock(currentContextMap->mMutex);
/* check the context is still opened */
currentContextMap = SCardGetContext(hContext);
@@ -3125,7 +3125,7 @@
/* set the reader names length */
*pcchReaders = dwReadersLen;
- (void)SYS_MutexUnLock(currentContextMap->mMutex);
+ (void)pthread_mutex_unlock(currentContextMap->mMutex);
PROFILE_END(rv)
@@ -3241,7 +3241,7 @@
if (NULL == currentContextMap)
return SCARD_E_INVALID_HANDLE;
- (void)SYS_MutexLock(currentContextMap->mMutex);
+ (void)pthread_mutex_lock(currentContextMap->mMutex);
/* check the context is still opened */
currentContextMap = SCardGetContext(hContext);
@@ -3283,7 +3283,7 @@
end:
*pcchGroups = dwGroups;
- (void)SYS_MutexUnLock(currentContextMap->mMutex);
+ (void)pthread_mutex_unlock(currentContextMap->mMutex);
PROFILE_END(rv)
@@ -3454,14 +3454,14 @@
newContextMap->hContext = hContext;
newContextMap->dwClientID = dwClientID;
- newContextMap->mMutex = malloc(sizeof(PCSCLITE_MUTEX));
+ newContextMap->mMutex = malloc(sizeof(pthread_mutex_t));
if (NULL == newContextMap->mMutex)
{
Log2(PCSC_LOG_DEBUG, "Freeing SCONTEXTMAP @%X", newContextMap);
free(newContextMap);
return SCARD_E_NO_MEMORY;
}
- (void)SYS_MutexInit(newContextMap->mMutex);
+ (void)pthread_mutex_init(newContextMap->mMutex, NULL);
lrv = list_init(&(newContextMap->channelMapList));
if (lrv < 0)
@@ -3493,7 +3493,7 @@
error:
- (void)SYS_MutexDestroy(newContextMap->mMutex);
+ (void)pthread_mutex_destroy(newContextMap->mMutex);
free(newContextMap->mMutex);
free(newContextMap);
@@ -3569,7 +3569,7 @@
targetContextMap->hContext = 0;
(void)SHMClientCloseSession(targetContextMap->dwClientID);
targetContextMap->dwClientID = 0;
- (void)SYS_MutexDestroy(targetContextMap->mMutex);
+ (void)pthread_mutex_destroy(targetContextMap->mMutex);
free(targetContextMap->mMutex);
targetContextMap->mMutex = NULL;
Modified: trunk/PCSC/src/winscard_svc.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/winscard_svc.c?rev=4885&op=diff
==============================================================================
--- trunk/PCSC/src/winscard_svc.c (original)
+++ trunk/PCSC/src/winscard_svc.c Sun Apr 18 12:17:56 2010
@@ -30,6 +30,7 @@
#include <stddef.h>
#include <stdlib.h>
#include <unistd.h>
+#include <pthread.h>
#include "pcscd.h"
#include "winscard.h"
@@ -53,13 +54,13 @@
static int contextMaxCardHandles = PCSC_MAX_CONTEXT_CARD_HANDLES;
static list_t contextsList; /**< Context tracking list */
-PCSCLITE_MUTEX contextsList_lock; /**< lock for the above list */
+pthread_mutex_t contextsList_lock; /**< lock for the above list */
struct _psContext
{
int32_t hContext;
list_t cardsList;
- PCSCLITE_MUTEX cardsList_lock; /**< lock for the above list */
+ pthread_mutex_t cardsList_lock; /**< lock for the above list */
uint32_t dwClientID; /**< Connection ID used to reference the Client. */
pthread_t pthThread; /**< Event polling thread's ID */
int protocol_major, protocol_minor; /**< Protocol number agreed between client and server*/
@@ -114,7 +115,7 @@
return -1;
}
- (void)SYS_MutexInit(&contextsList_lock);
+ (void)pthread_mutex_init(&contextsList_lock, NULL);
return 1;
}
@@ -144,9 +145,9 @@
int listSize;
SCONTEXT * newContext = NULL;
- (void)SYS_MutexLock(&contextsList_lock);
+ (void)pthread_mutex_lock(&contextsList_lock);
listSize = list_size(&contextsList);
- (void)SYS_MutexUnLock(&contextsList_lock);
+ (void)pthread_mutex_unlock(&contextsList_lock);
if (listSize >= contextMaxThreadCounter)
{
@@ -189,11 +190,11 @@
goto error;
}
- (void)SYS_MutexInit(&newContext->cardsList_lock);
-
- (void)SYS_MutexLock(&contextsList_lock);
+ (void)pthread_mutex_init(&newContext->cardsList_lock, NULL);
+
+ (void)pthread_mutex_lock(&contextsList_lock);
lrv = list_append(&contextsList, newContext);
- (void)SYS_MutexUnLock(&contextsList_lock);
+ (void)pthread_mutex_unlock(&contextsList_lock);
if (lrv < 0)
{
Log2(PCSC_LOG_CRITICAL, "list_append failed with return value: %X", lrv);
@@ -208,9 +209,9 @@
int lrv2;
Log2(PCSC_LOG_CRITICAL, "ThreadCreate failed: %s", strerror(rv));
- (void)SYS_MutexLock(&contextsList_lock);
+ (void)pthread_mutex_lock(&contextsList_lock);
lrv2 = list_delete(&contextsList, newContext);
- (void)SYS_MutexUnLock(&contextsList_lock);
+ (void)pthread_mutex_unlock(&contextsList_lock);
if (lrv2 < 0)
Log2(PCSC_LOG_CRITICAL, "list_delete failed with error %X", lrv2);
list_destroy(&(newContext->cardsList));
@@ -538,10 +539,10 @@
READ_BODY(caStr)
/* find the client */
- (void)SYS_MutexLock(&contextsList_lock);
+ (void)pthread_mutex_lock(&contextsList_lock);
psTargetContext = (SCONTEXT *) list_seek(&contextsList,
&(caStr.hContext));
- (void)SYS_MutexUnLock(&contextsList_lock);
+ (void)pthread_mutex_unlock(&contextsList_lock);
if (psTargetContext != NULL)
{
uint32_t fd = psTargetContext->dwClientID;
@@ -794,7 +795,7 @@
if (threadContext->hContext != hContext)
return SCARD_E_INVALID_VALUE;
- (void)SYS_MutexLock(&threadContext->cardsList_lock);
+ (void)pthread_mutex_lock(&threadContext->cardsList_lock);
while (list_size(&(threadContext->cardsList)) != 0)
{
READER_CONTEXT * rContext = NULL;
@@ -818,7 +819,7 @@
rv = RFReaderInfoById(hCard, &rContext);
if (rv != SCARD_S_SUCCESS)
{
- (void)SYS_MutexUnLock(&threadContext->cardsList_lock);
+ (void)pthread_mutex_unlock(&threadContext->cardsList_lock);
return rv;
}
@@ -854,7 +855,7 @@
Log2(PCSC_LOG_CRITICAL,
"list_delete_at failed with return value: %X", lrv);
}
- (void)SYS_MutexUnLock(&threadContext->cardsList_lock);
+ (void)pthread_mutex_unlock(&threadContext->cardsList_lock);
list_destroy(&(threadContext->cardsList));
/* We only mark the context as no longer in use.
@@ -883,9 +884,9 @@
return SCARD_E_NO_MEMORY;
}
- (void)SYS_MutexLock(&threadContext->cardsList_lock);
+ (void)pthread_mutex_lock(&threadContext->cardsList_lock);
lrv = list_append(&(threadContext->cardsList), &hCard);
- (void)SYS_MutexUnLock(&threadContext->cardsList_lock);
+ (void)pthread_mutex_unlock(&threadContext->cardsList_lock);
if (lrv < 0)
{
Log2(PCSC_LOG_CRITICAL, "list_append failed with return value: %X",
@@ -902,9 +903,9 @@
{
int lrv;
- (void)SYS_MutexLock(&threadContext->cardsList_lock);
+ (void)pthread_mutex_lock(&threadContext->cardsList_lock);
lrv = list_delete(&(threadContext->cardsList), &hCard);
- (void)SYS_MutexUnLock(&threadContext->cardsList_lock);
+ (void)pthread_mutex_unlock(&threadContext->cardsList_lock);
if (lrv < 0)
{
Log2(PCSC_LOG_CRITICAL, "list_delete failed with error %X", lrv);
@@ -918,9 +919,9 @@
static LONG MSGCheckHandleAssociation(SCARDHANDLE hCard, SCONTEXT * threadContext)
{
int list_index = 0;
- (void)SYS_MutexLock(&threadContext->cardsList_lock);
+ (void)pthread_mutex_lock(&threadContext->cardsList_lock);
list_index = list_locate(&(threadContext->cardsList), &hCard);
- (void)SYS_MutexUnLock(&threadContext->cardsList_lock);
+ (void)pthread_mutex_unlock(&threadContext->cardsList_lock);
if (list_index >= 0)
return 0;
@@ -956,10 +957,10 @@
memset((void*) threadContext, 0, sizeof(SCONTEXT));
Log2(PCSC_LOG_DEBUG, "Freeing SCONTEXT @%X", threadContext);
- (void)SYS_MutexLock(&contextsList_lock);
+ (void)pthread_mutex_lock(&contextsList_lock);
lrv = list_delete(&contextsList, threadContext);
listSize = list_size(&contextsList);
- (void)SYS_MutexUnLock(&contextsList_lock);
+ (void)pthread_mutex_unlock(&contextsList_lock);
if (lrv < 0)
Log2(PCSC_LOG_CRITICAL, "list_delete failed with error %x", lrv);
More information about the Pcsclite-cvs-commit
mailing list