Subversion Repositories HelenOS

Rev

Rev 3623 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3623 Rev 4377
Line 40... Line 40...
40
#include <arch.h>
40
#include <arch.h>
41
#include <errno.h>
41
#include <errno.h>
42
#include <debug.h>
42
#include <debug.h>
43
#include <udebug/udebug_ipc.h>
43
#include <udebug/udebug_ipc.h>
44
#include <ipc/kbox.h>
44
#include <ipc/kbox.h>
-
 
45
#include <print.h>
45
 
46
 
46
void ipc_kbox_cleanup(void)
47
void ipc_kbox_cleanup(void)
47
{
48
{
48
    ipl_t ipl;
49
    ipl_t ipl;
49
    bool have_kb_thread;
50
    bool have_kb_thread;
Line 126... Line 127...
126
    IPC_SET_RETVAL(call->data, 0);
127
    IPC_SET_RETVAL(call->data, 0);
127
    ipc_answer(&TASK->kb.box, call);
128
    ipc_answer(&TASK->kb.box, call);
128
 
129
 
129
    ipl = interrupts_disable();
130
    ipl = interrupts_disable();
130
    spinlock_lock(&TASK->lock);
131
    spinlock_lock(&TASK->lock);
131
    spinlock_lock(&TASK->answerbox.lock);
132
    spinlock_lock(&TASK->kb.box.lock);
132
    if (list_empty(&TASK->answerbox.connected_phones)) {
133
    if (list_empty(&TASK->kb.box.connected_phones)) {
133
        /*
134
        /*
134
         * Last phone has been disconnected. Detach this thread so it
135
         * Last phone has been disconnected. Detach this thread so it
135
         * gets freed and signal to the caller.
136
         * gets freed and signal to the caller.
136
         */
137
         */
137
 
138
 
Line 148... Line 149...
148
        *last = true;
149
        *last = true;
149
    } else {
150
    } else {
150
        *last = false;
151
        *last = false;
151
    }
152
    }
152
 
153
 
153
    spinlock_unlock(&TASK->answerbox.lock);
154
    spinlock_unlock(&TASK->kb.box.lock);
154
    spinlock_unlock(&TASK->lock);
155
    spinlock_unlock(&TASK->lock);
155
    interrupts_restore(ipl);
156
    interrupts_restore(ipl);
156
}
157
}
157
 
158
 
158
/** Implementing function for the kbox thread.
159
/** Implementing function for the kbox thread.