add timeout for waitreceivetaskend for the win32, fix GetLastError print
author'Gr?gory Tr?lat <gregory.trelat@lolitech.fr>'
Fri, 25 Sep 2009 14:12:39 +0200
changeset 600 7767029937aa
parent 594 17a171fe7c56
child 602 cbf29cccec18
add timeout for waitreceivetaskend for the win32, fix GetLastError print
drivers/timers_win32/timers_win32.c
drivers/win32/win32.c
--- a/drivers/timers_win32/timers_win32.c	Thu Sep 24 10:03:07 2009 +0200
+++ b/drivers/timers_win32/timers_win32.c	Fri Sep 25 14:12:39 2009 +0200
@@ -70,7 +70,10 @@
 
 void WaitReceiveTaskEnd(TASK_HANDLE *Thread)
 {
-	WaitForSingleObject(*Thread, INFINITE);
+	if(WaitForSingleObject(*Thread, 1000) == WAIT_TIMEOUT)
+	{
+		TerminateThread(*Thread, -1);
+	}
 	CloseHandle(*Thread);
 }
 
--- a/drivers/win32/win32.c	Thu Sep 24 10:03:07 2009 +0200
+++ b/drivers/win32/win32.c	Fri Sep 25 14:12:39 2009 +0200
@@ -103,7 +103,7 @@
 
 	if (!handle)
 	{
-		fprintf (stderr, "%s\n", GetLastError());
+		fprintf (stderr, "%d\n", GetLastError());
     	return NULL;
 	}
 
@@ -181,7 +181,7 @@
 /***************************************************************************/
 int canClose(CO_Data * d)
 {
-	UNS8 res;
+	UNS8 res = 1;
 	CANPort* tmp;
 
 	if((CANPort*)d->canHandle)