Commit 05846c6
committed
[utest]:Modify the execution logic of smp_thread_preemptions
Currently, the print information of this test case fails to demonstrate that
the high-priority thread has preempted the low-priority thread. This is because
when the high-priority thread prints the thread list, there is no information
about the low-priority thread (tlow), as tlow has already completed execution
and been destroyed. Therefore, the current execution logic cannot confirm the
successful completion of the preemption operation.
Solution: After the low-priority thread (tlow) releases the lock, add a busy-wait
loop while(!finish_flag);. At this point, when the high-priority thread (thigh)
prints the thread list information, tlow can be observed in the ready state, indicating
that it has been preempted by thigh.
Signed-off-by: Mengchen Teng <[email protected]>1 parent 39a52cd commit 05846c6
1 file changed
+4
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| |||
35 | 36 | | |
36 | 37 | | |
37 | 38 | | |
| 39 | + | |
38 | 40 | | |
39 | 41 | | |
40 | 42 | | |
| |||
46 | 48 | | |
47 | 49 | | |
48 | 50 | | |
| 51 | + | |
49 | 52 | | |
50 | 53 | | |
51 | 54 | | |
| |||
72 | 75 | | |
73 | 76 | | |
74 | 77 | | |
| 78 | + | |
75 | 79 | | |
76 | 80 | | |
77 | 81 | | |
| |||
0 commit comments