Some more reasonable timeout while waiting timer thread end
authoredouard@expresso
Tue, 06 Oct 2009 17:22:11 +0200
changeset 602 cbf29cccec18
parent 601 efb6e88ad27f (current diff)
parent 600 7767029937aa (diff)
child 603 4dc76e662412
Some more reasonable timeout while waiting timer thread end
drivers/timers_win32/timers_win32.c
--- a/drivers/timers_win32/timers_win32.c	Tue Oct 06 17:15:32 2009 +0200
+++ b/drivers/timers_win32/timers_win32.c	Tue Oct 06 17:22:11 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	Tue Oct 06 17:15:32 2009 +0200
+++ b/drivers/win32/win32.c	Tue Oct 06 17:22:11 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)