* Added kernel private thread_state_to_text() which just calls

state_to_text().
* state_to_text() can now deal with a NULL thread argument.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27163 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2008-08-22 23:51:22 +00:00
parent 97686ecc7a
commit 07569b03c9
2 changed files with 20 additions and 9 deletions
+2
View File
@@ -46,6 +46,8 @@ void thread_exit(void);
int32 thread_max_threads(void); int32 thread_max_threads(void);
int32 thread_used_threads(void); int32 thread_used_threads(void);
const char* thread_state_to_text(struct thread* thread, int32 state);
#define thread_get_current_thread arch_thread_get_current_thread #define thread_get_current_thread arch_thread_get_current_thread
struct thread *thread_get_thread_struct(thread_id id); struct thread *thread_get_thread_struct(thread_id id);
+18 -9
View File
@@ -1003,16 +1003,18 @@ state_to_text(struct thread *thread, int32 state)
case B_THREAD_WAITING: case B_THREAD_WAITING:
{ {
switch (thread->wait.type) { if (thread != NULL) {
case THREAD_BLOCK_TYPE_SNOOZE: switch (thread->wait.type) {
return "zzz"; case THREAD_BLOCK_TYPE_SNOOZE:
return "zzz";
case THREAD_BLOCK_TYPE_SEMAPHORE: case THREAD_BLOCK_TYPE_SEMAPHORE:
{ {
sem_id sem = (sem_id)(addr_t)thread->wait.object; sem_id sem = (sem_id)(addr_t)thread->wait.object;
if (sem == thread->msg.read_sem) if (sem == thread->msg.read_sem)
return "receive"; return "receive";
break; break;
}
} }
} }
@@ -1982,6 +1984,13 @@ thread_used_threads(void)
} }
const char*
thread_state_to_text(struct thread* thread, int32 state)
{
return state_to_text(thread, state);
}
status_t status_t
thread_init(kernel_args *args) thread_init(kernel_args *args)
{ {