Changeset f2f0392 in mainline
- Timestamp:
- 2007-06-28T20:47:03Z (17 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- daa90e8
- Parents:
- 9591265
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/libc/generic/async.c
r9591265 rf2f0392 257 257 } 258 258 259 /*************************************************/ 260 261 /** Try to route a call to an appropriate connection thread 259 /** Try to route a call to an appropriate connection fibril 262 260 * 263 261 */ … … 303 301 } 304 302 305 /** Return new incoming message for current(thread-local) connection */303 /** Return new incoming message for the current (fibril-local) connection */ 306 304 ipc_callid_t async_get_call_timeout(ipc_call_t *call, suseconds_t usecs) 307 305 { … … 354 352 } 355 353 356 /** Threadfunction that gets created on new connection354 /** Fibril function that gets created on new connection 357 355 * 358 356 * This function is defined as a weak symbol - to be redefined in … … 367 365 } 368 366 369 /** Wrapper for client connection thread 370 * 371 * When new connection arrives, thread with this function is created. 372 * It calls client_connection and does final cleanup. 373 * 374 * @param arg Connection structure pointer 367 /** Wrapper for client connection fibril. 368 * 369 * When new connection arrives, a fibril with this implementing function is 370 * created. It calls client_connection() and does the final cleanup. 371 * 372 * @param arg Connection structure pointer 373 * 374 * @return Always zero. 375 375 */ 376 376 static int connection_fibril(void *arg) … … 380 380 int close_answered = 0; 381 381 382 /* Setup threadlocal connection pointer */382 /* Setup fibril-local connection pointer */ 383 383 FIBRIL_connection = (connection_t *) arg; 384 384 FIBRIL_connection->cfibril(FIBRIL_connection->callid, … … 407 407 } 408 408 409 /** Create new thread for a new connection 410 * 411 * Creates new thread for connection, fills in connection 412 * structures and inserts it into the hash table, so that 413 * later we can easily do routing of messages to particular 414 * threads. 415 * 416 * @param in_phone_hash Identification of the incoming connection 417 * @param callid Callid of the IPC_M_CONNECT_ME_TO packet 418 * @param call Call data of the opening packet 419 * @param cfibril Fibril function that should be called upon 420 * opening the connection 421 * @return New fibril id. 409 /** Create a new fibril for a new connection. 410 * 411 * Creates new fibril for connection, fills in connection structures and inserts 412 * it into the hash table, so that later we can easily do routing of messages to 413 * particular fibrils. 414 * 415 * @param in_phone_hash Identification of the incoming connection 416 * @param callid Callid of the IPC_M_CONNECT_ME_TO packet 417 * @param call Call data of the opening packet 418 * @param cfibril Fibril function that should be called upon 419 * opening the connection 420 * @return New fibril id. 422 421 */ 423 422 fid_t async_new_connection(ipcarg_t in_phone_hash, ipc_callid_t callid, … … 458 457 } 459 458 460 /** Handle call that was received*/459 /** Handle a call that was received. */ 461 460 static void handle_call(ipc_callid_t callid, ipc_call_t *call) 462 461 { … … 471 470 switch (IPC_GET_METHOD(*call)) { 472 471 case IPC_M_CONNECT_ME_TO: 473 /* Open new connection with threadetc. */472 /* Open new connection with fibril etc. */ 474 473 async_new_connection(IPC_GET_ARG3(*call), callid, call, 475 474 client_connection); … … 485 484 } 486 485 487 /** Fire all timeouts that expired 488 * 489 */ 486 /** Fire all timeouts that expired. */ 490 487 static void handle_expired_timeouts(void) 491 488 { … … 506 503 waiter->inlist = 0; 507 504 waiter->timedout = 1; 508 /* Redundant condition? The threadshould not505 /* Redundant condition? The fibril should not 509 506 * be active when it gets here. 510 507 */ … … 531 528 futex_up(&async_futex); 532 529 /* async_futex is always held 533 * when entering manager thread530 * when entering manager fibril 534 531 */ 535 532 continue; … … 567 564 } 568 565 569 /** Function to start async_manager as a standalone thread566 /** Function to start async_manager as a standalone fibril. 570 567 * 571 568 * When more kernel threads are used, one async manager should 572 * exist per thread. The particular implementation may change, 573 * currently one async_manager is started automatically per kernel 574 * thread except the main thread. 569 * exist per thread. 575 570 */ 576 571 static int async_manager_fibril(void *arg) … … 615 610 * Notify the fibril which is waiting for this message, that it arrived 616 611 */ 617 static void reply_received(void *private, int retval, 618 ipc_call_t *data) 612 static void reply_received(void *private, int retval, ipc_call_t *data) 619 613 { 620 614 amsg_t *msg = (amsg_t *) private; … … 647 641 */ 648 642 aid_t async_send_2(int phoneid, ipcarg_t method, ipcarg_t arg1, ipcarg_t arg2, 649 643 ipc_call_t *dataptr) 650 644 { 651 645 amsg_t *msg; … … 674 668 */ 675 669 aid_t async_send_3(int phoneid, ipcarg_t method, ipcarg_t arg1, ipcarg_t arg2, 676 670 ipcarg_t arg3, ipc_call_t *dataptr) 677 671 { 678 672 amsg_t *msg; … … 697 691 /** Wait for a message sent by async framework 698 692 * 699 * @param amsgid Message ID to wait for 700 * @param retval Pointer to variable where will be stored retval 701 * of the answered message. If NULL, it is ignored. 702 * 693 * @param amsgid Message ID to wait for 694 * @param retval Pointer to variable where will be stored retval of the 695 * answered message. If NULL, it is ignored. 703 696 */ 704 697 void async_wait_for(aid_t amsgid, ipcarg_t *retval) … … 794 787 futex_down(&async_futex); 795 788 insert_timeout(&msg->wdata); 796 /* Leave locked async_futex when entering this function */789 /* Leave locked the async_futex when entering this function */ 797 790 fibril_schedule_next_adv(FIBRIL_TO_MANAGER); 798 /* futex is up automatically after fibril_schedule_next ...*/791 /* futex is up automatically after fibril_schedule_next_adv()...*/ 799 792 free(msg); 800 793 } 801 794 802 /** Set function that is called , IPC_M_CONNECT_ME_TO is received803 * 804 * @param conn Function that will form new psthread.795 /** Set function that is called when IPC_M_CONNECT_ME_TO is received. 796 * 797 * @param conn Function that will form a new fibril. 805 798 */ 806 799 void async_set_client_connection(async_client_conn_t conn)
Note:
See TracChangeset
for help on using the changeset viewer.