Ver Fonte

Demonstrate the termination bug

When the task1 is finished the program crashes.
DricomDragon há 5 anos atrás
pai
commit
fd2d59093a
1 ficheiros alterados com 3 adições e 1 exclusões
  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 ++;
 		}
 	}
 }