* 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

View File

@ -46,6 +46,8 @@ void thread_exit(void);
int32 thread_max_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
struct thread *thread_get_thread_struct(thread_id id);

View File

@ -1003,16 +1003,18 @@ state_to_text(struct thread *thread, int32 state)
case B_THREAD_WAITING:
{
switch (thread->wait.type) {
case THREAD_BLOCK_TYPE_SNOOZE:
return "zzz";
if (thread != NULL) {
switch (thread->wait.type) {
case THREAD_BLOCK_TYPE_SNOOZE:
return "zzz";
case THREAD_BLOCK_TYPE_SEMAPHORE:
{
sem_id sem = (sem_id)(addr_t)thread->wait.object;
if (sem == thread->msg.read_sem)
return "receive";
break;
case THREAD_BLOCK_TYPE_SEMAPHORE:
{
sem_id sem = (sem_id)(addr_t)thread->wait.object;
if (sem == thread->msg.read_sem)
return "receive";
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
thread_init(kernel_args *args)
{