Explorar el Código

Demonstrate the termination bug

When the task1 is finished the program crashes.
DricomDragon hace 5 años
padre
commit
fd2d59093a
Se han modificado 1 ficheros con 3 adiciones y 1 borrados
  1. 3 1
      prog/sources/user-tasks.cpp

+ 3 - 1
prog/sources/user-tasks.cpp

@@ -6,7 +6,8 @@ static uint64_t gStack1 [64] ;
 static uint32_t gDisplayTime = 0 ;
 
 static void task1 (USER_MODE) {
-	while (1) {
+	int counter(0);
+	while (counter < 4) {
 		if (gDisplayTime <= millis (MODE)) {
 			const uint32_t s = systick (MODE) ;
 			gotoLineColumn (MODE_ 1, 0) ;
@@ -16,6 +17,7 @@ static void task1 (USER_MODE) {
 			gotoLineColumn (MODE_ 3, 0) ;
 			printUnsigned64 (MODE_ micros (MODE)) ;
 			gDisplayTime += 1000 ;
+			counter ++;
 		}
 	}
 }