[Pcsclite-cvs-commit] r2403 - trunk/PCSC/src

Ludovic Rousseau rousseau at alioth.debian.org
Mon Feb 19 10:16:29 CET 2007


Author: rousseau
Date: 2007-02-19 10:16:29 +0100 (Mon, 19 Feb 2007)
New Revision: 2403

Modified:
   trunk/PCSC/src/sys_unix.c
Log:
SYS_USleep(): use select() instead of usleep() if nanosleep() can't be
used. usleep() is not thread safe on some old Solaris systems.

Thanks to Nils Larsch for the patch


Modified: trunk/PCSC/src/sys_unix.c
===================================================================
--- trunk/PCSC/src/sys_unix.c	2007-02-18 16:39:31 UTC (rev 2402)
+++ trunk/PCSC/src/sys_unix.c	2007-02-19 09:16:29 UTC (rev 2403)
@@ -105,8 +105,10 @@
 
 	return nanosleep(&mrqtp, NULL);
 #else
-	usleep(iTimeVal);
-	return iTimeVal;
+	struct timeval tv;
+	tv.tv_sec  = iTimeVal/1000000;
+	tv.tv_usec = iTimeVal - (tv.tv_sec * 1000000);
+	return select(0, NULL, NULL, NULL, &tv);
 #endif
 }
 




More information about the Pcsclite-cvs-commit mailing list