Subversion Repositories HelenOS-historic

Rev

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

Rev 1466 Rev 1470
Line 244... Line 244...
244
/** Return new incoming message for current(thread-local) connection */
244
/** Return new incoming message for current(thread-local) connection */
245
ipc_callid_t async_get_call(ipc_call_t *call)
245
ipc_callid_t async_get_call(ipc_call_t *call)
246
{
246
{
247
    msg_t *msg;
247
    msg_t *msg;
248
    ipc_callid_t callid;
248
    ipc_callid_t callid;
249
    connection_t *conn;
-
 
250
   
249
   
251
    assert(PS_connection);
250
    assert(PS_connection);
252
 
251
 
253
    futex_down(&async_futex);
252
    futex_down(&async_futex);
254
 
253
 
255
    conn = PS_connection;
-
 
256
    /* If nothing in queue, wait until something appears */
254
    /* If nothing in queue, wait until something appears */
257
    if (list_empty(&conn->msg_queue)) {
255
    if (list_empty(&PS_connection->msg_queue)) {
258
        conn->active = 0;
256
        PS_connection->active = 0;
259
        psthread_schedule_next_adv(PS_TO_MANAGER);
257
        psthread_schedule_next_adv(PS_TO_MANAGER);
260
    }
258
    }
261
   
259
   
262
    msg = list_get_instance(conn->msg_queue.next, msg_t, link);
260
    msg = list_get_instance(PS_connection->msg_queue.next, msg_t, link);
263
    list_remove(&msg->link);
261
    list_remove(&msg->link);
264
    callid = msg->callid;
262
    callid = msg->callid;
265
    *call = msg->call;
263
    *call = msg->call;
266
    free(msg);
264
    free(msg);
267
   
265
   
Line 298... Line 296...
298
 */
296
 */
299
static int connection_thread(void  *arg)
297
static int connection_thread(void  *arg)
300
{
298
{
301
    unsigned long key;
299
    unsigned long key;
302
    msg_t *msg;
300
    msg_t *msg;
303
    connection_t *conn;
-
 
304
 
301
 
305
    /* Setup thread local connection pointer */
302
    /* Setup thread local connection pointer */
306
    PS_connection = (connection_t *)arg;
303
    PS_connection = (connection_t *)arg;
307
    conn = PS_connection;
-
 
308
    conn->cthread(conn->callid, &conn->call);
304
    PS_connection->cthread(PS_connection->callid, &PS_connection->call);
309
 
305
 
310
    /* Remove myself from connection hash table */
306
    /* Remove myself from connection hash table */
311
    futex_down(&async_futex);
307
    futex_down(&async_futex);
312
    key = conn->in_phone_hash;
308
    key = PS_connection->in_phone_hash;
313
    hash_table_remove(&conn_hash_table, &key, 1);
309
    hash_table_remove(&conn_hash_table, &key, 1);
314
    futex_up(&async_futex);
310
    futex_up(&async_futex);
315
    /* Answer all remaining messages with ehangup */
311
    /* Answer all remaining messages with ehangup */
316
    while (!list_empty(&conn->msg_queue)) {
312
    while (!list_empty(&PS_connection->msg_queue)) {
317
        msg = list_get_instance(conn->msg_queue.next, msg_t, link);
313
        msg = list_get_instance(PS_connection->msg_queue.next, msg_t, link);
318
        list_remove(&msg->link);
314
        list_remove(&msg->link);
319
        ipc_answer_fast(msg->callid, EHANGUP, 0, 0);
315
        ipc_answer_fast(msg->callid, EHANGUP, 0, 0);
320
        free(msg);
316
        free(msg);
321
    }
317
    }
322
}
318
}