Skip to contentSkip to conversation

alchemy: Fully initialize tcb->self

PATCH New Jan Kiszka 1 participant 1 message Nov 19, 2019

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH 1/1 alchemy: Fully initialize tcb->self

From: Jan Kiszka <[email protected]>

Make sure the thread field of tcb->self is always initialized as rt_task_self returns it.

---
 lib/alchemy/task.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
lib/alchemy/task.c +4 -2
index 079d11b6e7..949a996d00 100644
@@ -443,10 +443,12 @@ int rt_task_create(RT_TASK *task, const char *name,
 	cta.stacksize = stksize;
 
 	ret = __bt(copperplate_create_thread(&cta, &tcb->thobj.ptid));
-	if (ret)
+	if (ret) {
 		delete_tcb(tcb);
-	else
+	} else {
+		tcb->self.thread = tcb->thobj.ptid;
 		task->thread = tcb->thobj.ptid;
+	}
 out:
 	CANCEL_RESTORE(svc);
 
Signature · 6 lines
2.16.4


-- 
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux