Changeset 94f8e3c1 in mainline for kernel/generic/src/ipc/kbox.c


Ignore:
Timestamp:
2008-10-20T20:45:19Z (16 years ago)
Author:
Jiri Svoboda <jirik.svoboda@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
5045a68
Parents:
338a8382
Message:

Fix panic when debugged task quits. Also fix memory leak when debugger disconnects first.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/ipc/kbox.c

    r338a8382 r94f8e3c1  
    4646void ipc_kbox_cleanup(void)
    4747{
     48        ipl_t ipl;
    4849        bool have_kb_thread;
    4950
     
    6465         */
    6566        ipc_answerbox_slam_phones(&TASK->kernel_box, have_kb_thread);
     67
     68        /*
     69         * If the task was being debugged, clean up debugging session.
     70         * This is necessarry as slamming the phones won't force
     71         * kbox thread to clean it up since sender != debugger.
     72         */
     73        ipl = interrupts_disable();
     74        spinlock_lock(&TASK->lock);
     75        udebug_task_cleanup(TASK);
     76        spinlock_unlock(&TASK->lock);
     77        interrupts_restore(ipl);
    6678       
    6779        if (have_kb_thread) {
     
    127139                                spinlock_lock(&TASK->answerbox.lock);
    128140                                if (list_empty(&TASK->answerbox.connected_phones)) {
    129                                         /* Last phone has been disconnected */
     141                                        /*
     142                                         * Last phone has been disconnected.
     143                                         */
     144
     145                                        /* Detach thread so it gets freed. */
     146                                        thread_detach(TASK->kb_thread);
    130147                                        TASK->kb_thread = NULL;
    131148                                        done = true;
Note: See TracChangeset for help on using the changeset viewer.