Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/async.c

    r3815efb r8869f7b  
    160160       
    161161        /** Messages that should be delivered to this fibril. */
    162         list_t msg_queue;
     162        link_t msg_queue;
    163163       
    164164        /** Identification of the opening call. */
     
    166166        /** Call data of the opening call. */
    167167        ipc_call_t call;
    168         /** Local argument or NULL if none. */
    169         void *carg;
    170168       
    171169        /** Identification of the closing call. */
     
    173171       
    174172        /** Fibril function that will be used to handle the connection. */
    175         async_client_conn_t cfibril;
     173        void (*cfibril)(ipc_callid_t, ipc_call_t *);
    176174} connection_t;
    177175
     
    215213 * @param callid Hash of the incoming call.
    216214 * @param call   Data of the incoming call.
    217  * @param arg    Local argument
    218  *
    219  */
    220 static void default_client_connection(ipc_callid_t callid, ipc_call_t *call,
    221     void *arg)
     215 *
     216 */
     217static void default_client_connection(ipc_callid_t callid, ipc_call_t *call)
    222218{
    223219        ipc_answer_0(callid, ENOENT);
     
    230226 * @param callid Hash of the incoming call.
    231227 * @param call   Data of the incoming call.
    232  * @param arg    Local argument.
    233228 *
    234229 */
     
    238233
    239234static async_client_conn_t client_connection = default_client_connection;
    240 static async_interrupt_handler_t interrupt_received = default_interrupt_received;
     235static async_client_conn_t interrupt_received = default_interrupt_received;
    241236
    242237/** Setter for client_connection function pointer.
     
    255250 *             notification fibril.
    256251 */
    257 void async_set_interrupt_received(async_interrupt_handler_t intr)
     252void async_set_interrupt_received(async_client_conn_t intr)
    258253{
    259254        interrupt_received = intr;
     
    361356        wd->to_event.inlist = true;
    362357       
    363         link_t *tmp = timeout_list.head.next;
    364         while (tmp != &timeout_list.head) {
     358        link_t *tmp = timeout_list.next;
     359        while (tmp != &timeout_list) {
    365360                awaiter_t *cur
    366361                    = list_get_instance(tmp, awaiter_t, to_event.link);
     
    372367        }
    373368       
    374         list_insert_before(&wd->to_event.link, tmp);
     369        list_append(&wd->to_event.link, tmp);
    375370}
    376371
     
    569564        }
    570565       
    571         msg_t *msg = list_get_instance(list_first(&conn->msg_queue), msg_t, link);
     566        msg_t *msg = list_get_instance(conn->msg_queue.next, msg_t, link);
    572567        list_remove(&msg->link);
    573568       
     
    638633         */
    639634        fibril_connection->cfibril(fibril_connection->callid,
    640             &fibril_connection->call, fibril_connection->carg);
     635            &fibril_connection->call);
    641636       
    642637        /*
     
    675670        while (!list_empty(&fibril_connection->msg_queue)) {
    676671                msg_t *msg =
    677                     list_get_instance(list_first(&fibril_connection->msg_queue),
    678                     msg_t, link);
     672                    list_get_instance(fibril_connection->msg_queue.next, msg_t,
     673                    link);
    679674               
    680675                list_remove(&msg->link);
     
    709704 * @param cfibril       Fibril function that should be called upon opening the
    710705 *                      connection.
    711  * @param carg          Extra argument to pass to the connection fibril
    712706 *
    713707 * @return New fibril id or NULL on failure.
     
    716710fid_t async_new_connection(sysarg_t in_task_hash, sysarg_t in_phone_hash,
    717711    ipc_callid_t callid, ipc_call_t *call,
    718     async_client_conn_t cfibril, void *carg)
     712    async_client_conn_t cfibril)
    719713{
    720714        connection_t *conn = malloc(sizeof(*conn));
     
    731725        conn->callid = callid;
    732726        conn->close_callid = 0;
    733         conn->carg = carg;
    734727       
    735728        if (call)
     
    786779                /* Open new connection with fibril, etc. */
    787780                async_new_connection(call->in_task_hash, IPC_GET_ARG5(*call),
    788                     callid, call, client_connection, NULL);
     781                    callid, call, client_connection);
    789782                return;
    790783        }
     
    806799        futex_down(&async_futex);
    807800       
    808         link_t *cur = list_first(&timeout_list);
    809         while (cur != NULL) {
     801        link_t *cur = timeout_list.next;
     802        while (cur != &timeout_list) {
    810803                awaiter_t *waiter =
    811804                    list_get_instance(cur, awaiter_t, to_event.link);
     
    813806                if (tv_gt(&waiter->to_event.expires, &tv))
    814807                        break;
     808               
     809                cur = cur->next;
    815810               
    816811                list_remove(&waiter->to_event.link);
     
    826821                        fibril_add_ready(waiter->fid);
    827822                }
    828                
    829                 cur = list_first(&timeout_list);
    830823        }
    831824       
     
    854847                suseconds_t timeout;
    855848                if (!list_empty(&timeout_list)) {
    856                         awaiter_t *waiter = list_get_instance(
    857                             list_first(&timeout_list), awaiter_t, to_event.link);
     849                        awaiter_t *waiter = list_get_instance(timeout_list.next,
     850                            awaiter_t, to_event.link);
    858851                       
    859852                        struct timeval tv;
     
    14211414 */
    14221415int async_connect_to_me(async_exch_t *exch, sysarg_t arg1, sysarg_t arg2,
    1423     sysarg_t arg3, async_client_conn_t client_receiver, void *carg)
     1416    sysarg_t arg3, async_client_conn_t client_receiver)
    14241417{
    14251418        if (exch == NULL)
     
    14351428        if (client_receiver != NULL)
    14361429                async_new_connection(task_hash, phone_hash, 0, NULL,
    1437                     client_receiver, carg);
     1430                    client_receiver);
    14381431       
    14391432        return EOK;
     
    17311724                 */
    17321725                exch = (async_exch_t *)
    1733                     list_get_instance(list_first(&sess->exch_list),
    1734                     async_exch_t, sess_link);
    1735                
     1726                    list_get_instance(sess->exch_list.next, async_exch_t, sess_link);
    17361727                list_remove(&exch->sess_link);
    17371728                list_remove(&exch->global_link);
     
    17451736                        exch = (async_exch_t *) malloc(sizeof(async_exch_t));
    17461737                        if (exch != NULL) {
    1747                                 link_initialize(&exch->sess_link);
    1748                                 link_initialize(&exch->global_link);
     1738                                list_initialize(&exch->sess_link);
     1739                                list_initialize(&exch->global_link);
    17491740                                exch->sess = sess;
    17501741                                exch->phone = sess->phone;
     
    17631754                                exch = (async_exch_t *) malloc(sizeof(async_exch_t));
    17641755                                if (exch != NULL) {
    1765                                         link_initialize(&exch->sess_link);
    1766                                         link_initialize(&exch->global_link);
     1756                                        list_initialize(&exch->sess_link);
     1757                                        list_initialize(&exch->global_link);
    17671758                                        exch->sess = sess;
    17681759                                        exch->phone = phone;
     
    17761767                                 */
    17771768                                exch = (async_exch_t *)
    1778                                     list_get_instance(list_first(&inactive_exch_list),
    1779                                     async_exch_t, global_link);
    1780                                
     1769                                    list_get_instance(inactive_exch_list.next, async_exch_t,
     1770                                    global_link);
    17811771                                list_remove(&exch->sess_link);
    17821772                                list_remove(&exch->global_link);
     
    18181808        async_sess_t *sess = exch->sess;
    18191809       
    1820         atomic_dec(&sess->refcnt);
    1821        
    18221810        if (sess->mgmt == EXCHANGE_SERIALIZE)
    18231811                fibril_mutex_unlock(&sess->mutex);
Note: See TracChangeset for help on using the changeset viewer.