Subversion Repositories HelenOS

Rev

Rev 3022 | Rev 4420 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3022 Rev 4055
Line 504... Line 504...
504
        free(conn);
504
        free(conn);
505
        if (callid)
505
        if (callid)
506
            ipc_answer_0(callid, ENOMEM);
506
            ipc_answer_0(callid, ENOMEM);
507
        return NULL;
507
        return NULL;
508
    }
508
    }
-
 
509
   
509
    /* Add connection to the connection hash table */
510
    /* Add connection to the connection hash table */
510
    key = conn->in_phone_hash;
511
    key = conn->in_phone_hash;
511
    futex_down(&async_futex);
512
    futex_down(&async_futex);
512
    hash_table_insert(&conn_hash_table, &key, &conn->link);
513
    hash_table_insert(&conn_hash_table, &key, &conn->link);
513
    futex_up(&async_futex);
514
    futex_up(&async_futex);
Line 522... Line 523...
522
 * If the call has the IPC_M_CONNECT_ME_TO method, a new connection is created.
523
 * If the call has the IPC_M_CONNECT_ME_TO method, a new connection is created.
523
 * Otherwise the call is routed to its connection fibril.
524
 * Otherwise the call is routed to its connection fibril.
524
 *
525
 *
525
 * @param callid    Hash of the incoming call.
526
 * @param callid    Hash of the incoming call.
526
 * @param call      Data of the incoming call.
527
 * @param call      Data of the incoming call.
-
 
528
 *
527
 */
529
 */
528
static void handle_call(ipc_callid_t callid, ipc_call_t *call)
530
static void handle_call(ipc_callid_t callid, ipc_call_t *call)
529
{
531
{
530
    /* Unrouted call - do some default behaviour */
532
    /* Unrouted call - do some default behaviour */
531
    if ((callid & IPC_CALLID_NOTIFICATION)) {
533
    if ((callid & IPC_CALLID_NOTIFICATION)) {
Line 738... Line 740...
738
aid_t async_send_fast(int phoneid, ipcarg_t method, ipcarg_t arg1,
740
aid_t async_send_fast(int phoneid, ipcarg_t method, ipcarg_t arg1,
739
    ipcarg_t arg2, ipcarg_t arg3, ipcarg_t arg4, ipc_call_t *dataptr)
741
    ipcarg_t arg2, ipcarg_t arg3, ipcarg_t arg4, ipc_call_t *dataptr)
740
{
742
{
741
    amsg_t *msg;
743
    amsg_t *msg;
742
 
744
   
743
    if (_in_interrupt_handler) {
-
 
744
        printf("Cannot send asynchronous request in interrupt "
-
 
745
            "handler.\n");
-
 
746
        _exit(1);
-
 
747
    }
-
 
748
 
-
 
749
    msg = malloc(sizeof(*msg));
745
    msg = malloc(sizeof(*msg));
750
    msg->done = 0;
746
    msg->done = 0;
751
    msg->dataptr = dataptr;
747
    msg->dataptr = dataptr;
752
 
748
   
753
    /* We may sleep in the next method, but it will use its own mechanism */
749
    /* We may sleep in the next method, but it will use its own mechanism */
754
    msg->wdata.active = 1;
750
    msg->wdata.active = 1;
755
               
751
               
756
    ipc_call_async_4(phoneid, method, arg1, arg2, arg3, arg4, msg,
752
    ipc_call_async_4(phoneid, method, arg1, arg2, arg3, arg4, msg,
757
        reply_received, 1);
753
        reply_received, !_in_interrupt_handler);
758
 
754
   
759
    return (aid_t) msg;
755
    return (aid_t) msg;
760
}
756
}
761
 
757
 
762
/** Send message and return id of the sent message
758
/** Send message and return id of the sent message
Line 780... Line 776...
780
    ipcarg_t arg2, ipcarg_t arg3, ipcarg_t arg4, ipcarg_t arg5,
776
    ipcarg_t arg2, ipcarg_t arg3, ipcarg_t arg4, ipcarg_t arg5,
781
    ipc_call_t *dataptr)
777
    ipc_call_t *dataptr)
782
{
778
{
783
    amsg_t *msg;
779
    amsg_t *msg;
784
 
780
   
785
    if (_in_interrupt_handler) {
-
 
786
        printf("Cannot send asynchronous request in interrupt "
-
 
787
            "handler.\n");
-
 
788
        _exit(1);
-
 
789
    }
-
 
790
 
-
 
791
    msg = malloc(sizeof(*msg));
781
    msg = malloc(sizeof(*msg));
792
    msg->done = 0;
782
    msg->done = 0;
793
    msg->dataptr = dataptr;
783
    msg->dataptr = dataptr;
794
 
784
   
795
    /* We may sleep in next method, but it will use its own mechanism */
785
    /* We may sleep in next method, but it will use its own mechanism */
796
    msg->wdata.active = 1;
786
    msg->wdata.active = 1;
797
 
787
   
798
    ipc_call_async_5(phoneid, method, arg1, arg2, arg3, arg4, arg5, msg,
788
    ipc_call_async_5(phoneid, method, arg1, arg2, arg3, arg4, arg5, msg,
799
        reply_received, 1);
789
        reply_received, !_in_interrupt_handler);
800
 
790
   
801
    return (aid_t) msg;
791
    return (aid_t) msg;
802
}
792
}
803
 
793
 
804
/** Wait for a message sent by the async framework.
794
/** Wait for a message sent by the async framework.
Line 882... Line 872...
882
 */
872
 */
883
void async_usleep(suseconds_t timeout)
873
void async_usleep(suseconds_t timeout)
884
{
874
{
885
    amsg_t *msg;
875
    amsg_t *msg;
886
   
876
   
887
    if (_in_interrupt_handler) {
-
 
888
        printf("Cannot call async_usleep in interrupt handler.\n");
-
 
889
        _exit(1);
-
 
890
    }
-
 
891
 
-
 
892
    msg = malloc(sizeof(*msg));
877
    msg = malloc(sizeof(*msg));
893
    if (!msg)
878
    if (!msg)
894
        return;
879
        return;
895
 
880
   
896
    msg->wdata.fid = fibril_get_id();
881
    msg->wdata.fid = fibril_get_id();
Line 1010... Line 995...
1010
    return rc;
995
    return rc;
1011
}
996
}
1012
 
997
 
1013
/** @}
998
/** @}
1014
 */
999
 */
1015
 
-