Changeset 9a1b20c in mainline for kernel/generic/src/proc/thread.c


Ignore:
Timestamp:
2008-09-17T12:16:27Z (16 years ago)
Author:
Jiri Svoboda <jirik.svoboda@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
fb9b0b0
Parents:
06a195bc
Message:

Merge syscall tracer (trace) and relevant part of udebug interface from tracing to trunk.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/proc/thread.c

    r06a195bc r9a1b20c  
    181181        }
    182182
     183#ifdef CONFIG_UDEBUG
     184        mutex_initialize(&t->udebug.lock, MUTEX_PASSIVE);
     185#endif
     186
    183187        return 0;
    184188}
     
    348352        t->threads_tree_node.key = (uintptr_t) t;
    349353
     354#ifdef CONFIG_UDEBUG
     355        /* Init debugging stuff */
     356        udebug_thread_initialize(&t->udebug);
     357#endif
     358
    350359        /* might depend on previous initialization */
    351360        thread_create_arch(t); 
     
    410419
    411420        /*
    412          * Attach to the current task.
     421         * Attach to the specified task.
    413422         */
    414423        ipl = interrupts_disable();
    415424        spinlock_lock(&task->lock);
     425
    416426        atomic_inc(&task->refcount);
    417         atomic_inc(&task->lifecount);
     427
     428        /* Must not count kbox thread into lifecount */
     429        if (t->flags & THREAD_FLAG_USPACE)
     430                atomic_inc(&task->lifecount);
     431
    418432        list_append(&t->th_link, &task->th_head);
    419433        spinlock_unlock(&task->lock);
     
    438452        ipl_t ipl;
    439453
    440         if (atomic_predec(&TASK->lifecount) == 0) {
    441                 /*
    442                  * We are the last thread in the task that still has not exited.
    443                  * With the exception of the moment the task was created, new
    444                  * threads can only be created by threads of the same task.
    445                  * We are safe to perform cleanup.
    446                  */
    447                 if (THREAD->flags & THREAD_FLAG_USPACE) {
     454        if (THREAD->flags & THREAD_FLAG_USPACE) {
     455#ifdef CONFIG_UDEBUG
     456                /* Generate udebug THREAD_E event */
     457                udebug_thread_e_event();
     458#endif
     459                if (atomic_predec(&TASK->lifecount) == 0) {
     460                        /*
     461                         * We are the last userspace thread in the task that
     462                         * still has not exited. With the exception of the
     463                         * moment the task was created, new userspace threads
     464                         * can only be created by threads of the same task.
     465                         * We are safe to perform cleanup.
     466                         */
    448467                        ipc_cleanup();
    449468                        futex_cleanup();
     
    742761                thread_ready(t);
    743762
     763#ifdef CONFIG_UDEBUG
     764                /* Generate udebug THREAD_B event */
     765                udebug_thread_b_event(t);
     766#endif
     767
    744768                return 0;
    745769        } else
Note: See TracChangeset for help on using the changeset viewer.