Changeset 6b21292 in mainline
- Timestamp:
- 2008-12-30T19:34:23Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 3ad953c
- Parents:
- 1c1002a
- Location:
- uspace/lib/libc
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/libc/generic/async.c
r1c1002a r6b21292 484 484 connection_t *conn; 485 485 unsigned long key; 486 486 487 487 conn = malloc(sizeof(*conn)); 488 488 if (!conn) { … … 499 499 conn->wdata.active = 1; /* We will activate the fibril ASAP */ 500 500 conn->cfibril = cfibril; 501 501 502 502 conn->wdata.fid = fibril_create(connection_fibril, conn); 503 503 if (!conn->wdata.fid) { … … 507 507 return NULL; 508 508 } 509 509 510 /* Add connection to the connection hash table */ 510 511 key = conn->in_phone_hash; … … 512 513 hash_table_insert(&conn_hash_table, &key, &conn->link); 513 514 futex_up(&async_futex); 514 515 515 516 fibril_add_ready(conn->wdata.fid); 516 517 517 518 return conn->wdata.fid; 518 519 } … … 525 526 * @param callid Hash of the incoming call. 526 527 * @param call Data of the incoming call. 528 * 527 529 */ 528 530 static void handle_call(ipc_callid_t callid, ipc_call_t *call) … … 534 536 _in_interrupt_handler = 0; 535 537 return; 536 } 537 538 } 539 538 540 switch (IPC_GET_METHOD(*call)) { 539 541 case IPC_M_CONNECT_ME_TO: … … 543 545 return; 544 546 } 545 547 546 548 /* Try to route the call through the connection hash table */ 547 549 if (route_call(callid, call)) 548 550 return; 549 551 550 552 /* Unknown call from unknown phone - hang it up */ 551 553 ipc_answer_0(callid, EHANGUP); … … 740 742 { 741 743 amsg_t *msg; 742 743 if (_in_interrupt_handler) { 744 printf("Cannot send asynchronous request in interrupt " 745 "handler.\n"); 746 _exit(1); 747 } 748 744 749 745 msg = malloc(sizeof(*msg)); 750 746 msg->done = 0; 751 747 msg->dataptr = dataptr; 752 748 753 749 /* We may sleep in the next method, but it will use its own mechanism */ 754 750 msg->wdata.active = 1; 755 751 756 752 ipc_call_async_4(phoneid, method, arg1, arg2, arg3, arg4, msg, 757 reply_received, 1);758 753 reply_received, !_in_interrupt_handler); 754 759 755 return (aid_t) msg; 760 756 } … … 782 778 { 783 779 amsg_t *msg; 784 785 if (_in_interrupt_handler) { 786 printf("Cannot send asynchronous request in interrupt " 787 "handler.\n"); 788 _exit(1); 789 } 790 780 791 781 msg = malloc(sizeof(*msg)); 792 782 msg->done = 0; 793 783 msg->dataptr = dataptr; 794 784 795 785 /* We may sleep in next method, but it will use its own mechanism */ 796 786 msg->wdata.active = 1; 797 787 798 788 ipc_call_async_5(phoneid, method, arg1, arg2, arg3, arg4, arg5, msg, 799 reply_received, 1);800 789 reply_received, !_in_interrupt_handler); 790 801 791 return (aid_t) msg; 802 792 } … … 885 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 877 msg = malloc(sizeof(*msg)); 893 878 if (!msg) 894 879 return; 895 880 896 881 msg->wdata.fid = fibril_get_id(); 897 882 msg->wdata.active = 0; 898 883 899 884 gettimeofday(&msg->wdata.expires, NULL); 900 885 tv_add(&msg->wdata.expires, timeout); 901 886 902 887 futex_down(&async_futex); 903 888 insert_timeout(&msg->wdata); -
uspace/lib/libc/include/async.h
r1c1002a r6b21292 119 119 * User-friendly wrappers for async_req_fast() and async_req_slow(). The macros 120 120 * are in the form async_req_m_n(), where m is the number of payload arguments 121 * and n is the number of return arguments. The macros decid ce between the fast121 * and n is the number of return arguments. The macros decide between the fast 122 122 * and slow verion based on m. 123 123 */
Note:
See TracChangeset
for help on using the changeset viewer.