Revision 82b6a25c kernel/patches/introduce-thread-hierarchy.patch
kernel/patches/introduce-thread-hierarchy.patch | ||
---|---|---|
194 | 194 |
#if CH_CFG_USE_WAITEXIT == TRUE |
195 | 195 |
list_init(&tp->waiting); |
196 | 196 |
#endif |
197 |
@@ -190,7 +246,11 @@ thread_t *chThdCreateSuspendedI(const thread_descriptor_t *tdp) {
|
|
197 |
@@ -190,7 +244,11 @@ thread_t *chThdCreateSuspendedI(const thread_descriptor_t *tdp) {
|
|
198 | 198 |
PORT_SETUP_CONTEXT(tp, tdp->wbase, tp, tdp->funcp, tdp->arg); |
199 | 199 |
|
200 | 200 |
/* The driver object is initialized but not started.*/ |
... | ... | |
206 | 206 |
} |
207 | 207 |
|
208 | 208 |
/** |
209 |
@@ -300,6 +360,7 @@ thread_t *chThdCreate(const thread_descriptor_t *tdp) {
|
|
209 |
@@ -300,6 +358,7 @@ thread_t *chThdCreate(const thread_descriptor_t *tdp) {
|
|
210 | 210 |
return tp; |
211 | 211 |
} |
212 | 212 |
|
... | ... | |
214 | 214 |
/** |
215 | 215 |
* @brief Creates a new thread into a static memory area. |
216 | 216 |
* @post The created thread has a reference counter set to one, it is |
217 |
@@ -315,13 +376,20 @@ thread_t *chThdCreate(const thread_descriptor_t *tdp) {
|
|
217 |
@@ -315,13 +374,20 @@ thread_t *chThdCreate(const thread_descriptor_t *tdp) {
|
|
218 | 218 |
* @param[in] pf the thread function |
219 | 219 |
* @param[in] arg an argument passed to the thread function. It can be |
220 | 220 |
* @p NULL. |
... | ... | |
235 | 235 |
thread_t *tp; |
236 | 236 |
|
237 | 237 |
chDbgCheck((wsp != NULL) && |
238 |
@@ -358,7 +426,11 @@ thread_t *chThdCreateStatic(void *wsp, size_t size,
|
|
238 |
@@ -358,7 +424,11 @@ thread_t *chThdCreateStatic(void *wsp, size_t size,
|
|
239 | 239 |
/* Setting up the port-dependent part of the working area.*/ |
240 | 240 |
PORT_SETUP_CONTEXT(tp, wsp, tp, pf, arg); |
241 | 241 |
|
... | ... | |
247 | 247 |
|
248 | 248 |
/* Starting the thread immediately.*/ |
249 | 249 |
chSchWakeupS(tp, MSG_OK); |
250 |
@@ -529,6 +601,30 @@ void chThdExitS(msg_t msg) {
|
|
250 |
@@ -529,6 +599,30 @@ void chThdExitS(msg_t msg) {
|
|
251 | 251 |
#endif |
252 | 252 |
#endif |
253 | 253 |
|
... | ... | |
278 | 278 |
/* Going into final state.*/ |
279 | 279 |
chSchGoSleepS(CH_STATE_FINAL); |
280 | 280 |
|
281 |
@@ -610,6 +706,43 @@ tprio_t chThdSetPriority(tprio_t newprio) {
|
|
281 |
@@ -610,6 +704,43 @@ tprio_t chThdSetPriority(tprio_t newprio) {
|
|
282 | 282 |
#else |
283 | 283 |
oldprio = currp->prio; |
284 | 284 |
currp->prio = newprio; |
... | ... | |
451 | 451 |
test_wait_threads(); |
452 | 452 |
test_assert_sequence("ABCDE", "invalid sequence"); |
453 | 453 |
} |
454 |
@@ -325,6 +339,405 @@ static const testcase_t rt_test_003_004 = {
|
|
454 |
@@ -325,6 +339,408 @@ static const testcase_t rt_test_003_004 = {
|
|
455 | 455 |
}; |
456 | 456 |
#endif /* CH_CFG_USE_MUTEXES */ |
457 | 457 |
|
... | ... | |
511 | 511 |
+ siblings[2] = threads[2]->sibling; |
512 | 512 |
+ siblings[3] = threads[3]->sibling; |
513 | 513 |
+ siblings[4] = threads[4]->sibling; |
514 |
+ chThdTerminate(threads[0]); |
|
515 |
+ chThdTerminate(threads[1]); |
|
516 |
+ chThdTerminate(threads[2]); |
|
517 |
+ chThdTerminate(threads[3]); |
|
518 |
+ chThdTerminate(threads[4]); |
|
514 |
+ test_terminate_threads(); |
|
519 | 515 |
+ test_wait_threads(); |
520 | 516 |
+ test_assert(parents[0] == chThdGetSelfX() && |
521 | 517 |
+ parents[1] == threads_cpy[0] && |
... | ... | |
660 | 656 |
+ threads_cpy[2] = threads[2]; |
661 | 657 |
+ threads_cpy[3] = threads[3]; |
662 | 658 |
+ threads_cpy[4] = threads[4]; |
659 |
+#if CH_CFG_USE_REGISTRY == TRUE |
|
660 |
+ chThdAddRef(threads[1]); |
|
661 |
+ chThdAddRef(threads[4]); |
|
662 |
+#endif |
|
663 | 663 |
+ chThdTerminate(threads[1]); |
664 | 664 |
+ chThdTerminate(threads[4]); |
665 | 665 |
+ chThdWait(threads[1]); |
... | ... | |
707 | 707 |
+ threads_cpy[2] = threads[2]; |
708 | 708 |
+ threads_cpy[3] = threads[3]; |
709 | 709 |
+ threads_cpy[4] = threads[4]; |
710 |
+#if CH_CFG_USE_REGISTRY == TRUE |
|
711 |
+ chThdAddRef(threads[0]); |
|
712 |
+#endif |
|
710 | 713 |
+ chThdTerminate(threads[0]); |
711 | 714 |
+ chThdWait(threads[0]); |
712 | 715 |
+ parents[0] = threads_cpy[0]->parent; |
... | ... | |
857 | 860 |
/**************************************************************************** |
858 | 861 |
* Exported data. |
859 | 862 |
****************************************************************************/ |
860 |
@@ -338,6 +751,9 @@ const testcase_t * const rt_test_sequence_003_array[] = {
|
|
863 |
@@ -338,6 +754,9 @@ const testcase_t * const rt_test_sequence_003_array[] = {
|
|
861 | 864 |
&rt_test_003_003, |
862 | 865 |
#if (CH_CFG_USE_MUTEXES) || defined(__DOXYGEN__) |
863 | 866 |
&rt_test_003_004, |
... | ... | |
1215 | 1218 |
} |
1216 | 1219 |
|
1217 | 1220 |
/* [10.8.2] Waiting one second then terminating the 5 threads.*/ |
1221 |
-- |
|
1222 |
2.17.1 |
|
1223 |
|
Also available in: Unified diff