Changes in uspace/lib/c/generic/async.c [3815efb:8869f7b] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/async.c
r3815efb r8869f7b 160 160 161 161 /** Messages that should be delivered to this fibril. */ 162 li st_t msg_queue;162 link_t msg_queue; 163 163 164 164 /** Identification of the opening call. */ … … 166 166 /** Call data of the opening call. */ 167 167 ipc_call_t call; 168 /** Local argument or NULL if none. */169 void *carg;170 168 171 169 /** Identification of the closing call. */ … … 173 171 174 172 /** 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 *); 176 174 } connection_t; 177 175 … … 215 213 * @param callid Hash of the incoming call. 216 214 * @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 */ 217 static void default_client_connection(ipc_callid_t callid, ipc_call_t *call) 222 218 { 223 219 ipc_answer_0(callid, ENOENT); … … 230 226 * @param callid Hash of the incoming call. 231 227 * @param call Data of the incoming call. 232 * @param arg Local argument.233 228 * 234 229 */ … … 238 233 239 234 static async_client_conn_t client_connection = default_client_connection; 240 static async_ interrupt_handler_t interrupt_received = default_interrupt_received;235 static async_client_conn_t interrupt_received = default_interrupt_received; 241 236 242 237 /** Setter for client_connection function pointer. … … 255 250 * notification fibril. 256 251 */ 257 void async_set_interrupt_received(async_ interrupt_handler_t intr)252 void async_set_interrupt_received(async_client_conn_t intr) 258 253 { 259 254 interrupt_received = intr; … … 361 356 wd->to_event.inlist = true; 362 357 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) { 365 360 awaiter_t *cur 366 361 = list_get_instance(tmp, awaiter_t, to_event.link); … … 372 367 } 373 368 374 list_ insert_before(&wd->to_event.link, tmp);369 list_append(&wd->to_event.link, tmp); 375 370 } 376 371 … … 569 564 } 570 565 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); 572 567 list_remove(&msg->link); 573 568 … … 638 633 */ 639 634 fibril_connection->cfibril(fibril_connection->callid, 640 &fibril_connection->call , fibril_connection->carg);635 &fibril_connection->call); 641 636 642 637 /* … … 675 670 while (!list_empty(&fibril_connection->msg_queue)) { 676 671 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); 679 674 680 675 list_remove(&msg->link); … … 709 704 * @param cfibril Fibril function that should be called upon opening the 710 705 * connection. 711 * @param carg Extra argument to pass to the connection fibril712 706 * 713 707 * @return New fibril id or NULL on failure. … … 716 710 fid_t async_new_connection(sysarg_t in_task_hash, sysarg_t in_phone_hash, 717 711 ipc_callid_t callid, ipc_call_t *call, 718 async_client_conn_t cfibril , void *carg)712 async_client_conn_t cfibril) 719 713 { 720 714 connection_t *conn = malloc(sizeof(*conn)); … … 731 725 conn->callid = callid; 732 726 conn->close_callid = 0; 733 conn->carg = carg;734 727 735 728 if (call) … … 786 779 /* Open new connection with fibril, etc. */ 787 780 async_new_connection(call->in_task_hash, IPC_GET_ARG5(*call), 788 callid, call, client_connection , NULL);781 callid, call, client_connection); 789 782 return; 790 783 } … … 806 799 futex_down(&async_futex); 807 800 808 link_t *cur = list_first(&timeout_list);809 while (cur != NULL) {801 link_t *cur = timeout_list.next; 802 while (cur != &timeout_list) { 810 803 awaiter_t *waiter = 811 804 list_get_instance(cur, awaiter_t, to_event.link); … … 813 806 if (tv_gt(&waiter->to_event.expires, &tv)) 814 807 break; 808 809 cur = cur->next; 815 810 816 811 list_remove(&waiter->to_event.link); … … 826 821 fibril_add_ready(waiter->fid); 827 822 } 828 829 cur = list_first(&timeout_list);830 823 } 831 824 … … 854 847 suseconds_t timeout; 855 848 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); 858 851 859 852 struct timeval tv; … … 1421 1414 */ 1422 1415 int 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) 1424 1417 { 1425 1418 if (exch == NULL) … … 1435 1428 if (client_receiver != NULL) 1436 1429 async_new_connection(task_hash, phone_hash, 0, NULL, 1437 client_receiver , carg);1430 client_receiver); 1438 1431 1439 1432 return EOK; … … 1731 1724 */ 1732 1725 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); 1736 1727 list_remove(&exch->sess_link); 1737 1728 list_remove(&exch->global_link); … … 1745 1736 exch = (async_exch_t *) malloc(sizeof(async_exch_t)); 1746 1737 if (exch != NULL) { 1747 li nk_initialize(&exch->sess_link);1748 li nk_initialize(&exch->global_link);1738 list_initialize(&exch->sess_link); 1739 list_initialize(&exch->global_link); 1749 1740 exch->sess = sess; 1750 1741 exch->phone = sess->phone; … … 1763 1754 exch = (async_exch_t *) malloc(sizeof(async_exch_t)); 1764 1755 if (exch != NULL) { 1765 li nk_initialize(&exch->sess_link);1766 li nk_initialize(&exch->global_link);1756 list_initialize(&exch->sess_link); 1757 list_initialize(&exch->global_link); 1767 1758 exch->sess = sess; 1768 1759 exch->phone = phone; … … 1776 1767 */ 1777 1768 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); 1781 1771 list_remove(&exch->sess_link); 1782 1772 list_remove(&exch->global_link); … … 1818 1808 async_sess_t *sess = exch->sess; 1819 1809 1820 atomic_dec(&sess->refcnt);1821 1822 1810 if (sess->mgmt == EXCHANGE_SERIALIZE) 1823 1811 fibril_mutex_unlock(&sess->mutex);
Note:
See TracChangeset
for help on using the changeset viewer.