[syslinux:lwip] core: thread: add a name field

syslinux-bot for H. Peter Anvin hpa at zytor.com
Fri Apr 22 20:05:07 PDT 2011


Commit-ID:  117cc6f82e163769c5b59ef8f93d25452e0d83dc
Gitweb:     http://syslinux.zytor.com/commit/117cc6f82e163769c5b59ef8f93d25452e0d83dc
Author:     H. Peter Anvin <hpa at zytor.com>
AuthorDate: Mon, 14 Sep 2009 21:34:57 -0700
Committer:  Eric W. Biederman <ebiederm at xmission.com>
CommitDate: Sat, 9 Apr 2011 18:27:06 -0700

core: thread: add a name field

Add a name field to struct thread, for debugging's sake.

Signed-off-by: Eric W. Biederman <ebiederm at xmission.com>


---
 core/include/thread.h      |    3 ++-
 core/thread/idle_thread.c  |    2 +-
 core/thread/root_thread.c  |    1 +
 core/thread/start_thread.c |    3 ++-
 4 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/core/include/thread.h b/core/include/thread.h
index e82a80b..db4ef5e 100644
--- a/core/include/thread.h
+++ b/core/include/thread.h
@@ -22,6 +22,7 @@ struct thread_block {
 
 struct thread {
     void *esp;			/* Must be first; stack pointer */
+    const char *name;		/* Name (for debugging) */
     struct thread_list  list;
     struct thread_block *blocked;
     void *pvt; 			/* For the benefit of lwIP */
@@ -82,7 +83,7 @@ static inline void irq_restore(irq_state_t __st)
     asm volatile("pushl %0 ; popfl" : : "rm" (__st));
 }
 
-struct thread *start_thread(size_t stack_size, int prio,
+struct thread *start_thread(const char *name, size_t stack_size, int prio,
 			    void (*start_func)(void *), void *func_arg);
 void __exit_thread(void);
 void kill_thread(struct thread *);
diff --git a/core/thread/idle_thread.c b/core/thread/idle_thread.c
index 5c79e31..b51a462 100644
--- a/core/thread/idle_thread.c
+++ b/core/thread/idle_thread.c
@@ -15,6 +15,6 @@ static void idle_thread_func(void *dummy)
 
 void start_idle_thread(void)
 {
-    start_thread(4096, INT_MAX, idle_thread_func, NULL);
+    start_thread("idle", 4096, INT_MAX, idle_thread_func, NULL);
 }
 
diff --git a/core/thread/root_thread.c b/core/thread/root_thread.c
index c5efd65..60f3492 100644
--- a/core/thread/root_thread.c
+++ b/core/thread/root_thread.c
@@ -1,6 +1,7 @@
 #include "thread.h"
 
 struct thread __root_thread = {
+    .name = "root",
     .list = { .next = &__root_thread.list, .prev = &__root_thread.list },
     .blocked = NULL,
     .prio = 0,
diff --git a/core/thread/start_thread.c b/core/thread/start_thread.c
index 29e9972..5486e56 100644
--- a/core/thread/start_thread.c
+++ b/core/thread/start_thread.c
@@ -13,7 +13,7 @@ struct thread_stack {
     void (*eip)(void);
 };
 
-struct thread *start_thread(size_t stack_size, int prio,
+struct thread *start_thread(const char *name, size_t stack_size, int prio,
 			    void (*start_func)(void *), void *func_arg)
 {
     irq_state_t irq;
@@ -42,6 +42,7 @@ struct thread *start_thread(size_t stack_size, int prio,
     sp->ebx = irq_state();	/* Inherit the IRQ state from the spawner */
     sp->eip = __start_thread;
     t->prio = prio;
+    t->name = name;
 
     irq = irq_save();
     curr = current();



More information about the Syslinux-commits mailing list