Changeset f2f0392 in mainline


Ignore:
Timestamp:
2007-06-28T20:47:03Z (17 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
daa90e8
Parents:
9591265
Message:

More fibril/psthread cleanup.

File:
1 edited

Legend:

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

    r9591265 rf2f0392  
    257257}
    258258
    259 /*************************************************/
    260 
    261 /** Try to route a call to an appropriate connection thread
     259/** Try to route a call to an appropriate connection fibril
    262260 *
    263261 */
     
    303301}
    304302
    305 /** Return new incoming message for current(thread-local) connection */
     303/** Return new incoming message for the current (fibril-local) connection */
    306304ipc_callid_t async_get_call_timeout(ipc_call_t *call, suseconds_t usecs)
    307305{
     
    354352}
    355353
    356 /** Thread function that gets created on new connection
     354/** Fibril function that gets created on new connection
    357355 *
    358356 * This function is defined as a weak symbol - to be redefined in
     
    367365}
    368366
    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.
    375375 */
    376376static int connection_fibril(void  *arg)
     
    380380        int close_answered = 0;
    381381
    382         /* Setup thread local connection pointer */
     382        /* Setup fibril-local connection pointer */
    383383        FIBRIL_connection = (connection_t *) arg;
    384384        FIBRIL_connection->cfibril(FIBRIL_connection->callid,
     
    407407}
    408408
    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.
    422421 */
    423422fid_t async_new_connection(ipcarg_t in_phone_hash, ipc_callid_t callid,
     
    458457}
    459458
    460 /** Handle call that was received */
     459/** Handle a call that was received. */
    461460static void handle_call(ipc_callid_t callid, ipc_call_t *call)
    462461{
     
    471470        switch (IPC_GET_METHOD(*call)) {
    472471        case IPC_M_CONNECT_ME_TO:
    473                 /* Open new connection with thread etc. */
     472                /* Open new connection with fibril etc. */
    474473                async_new_connection(IPC_GET_ARG3(*call), callid, call,
    475474                    client_connection);
     
    485484}
    486485
    487 /** Fire all timeouts that expired
    488  *
    489  */
     486/** Fire all timeouts that expired. */
    490487static void handle_expired_timeouts(void)
    491488{
     
    506503                waiter->inlist = 0;
    507504                waiter->timedout = 1;
    508                 /* Redundant condition? The thread should not
     505                /* Redundant condition? The fibril should not
    509506                 * be active when it gets here.
    510507                 */
     
    531528                        futex_up(&async_futex);
    532529                        /* async_futex is always held
    533                          * when entering manager thread
     530                         * when entering manager fibril
    534531                         */
    535532                        continue;
     
    567564}
    568565
    569 /** Function to start async_manager as a standalone thread
     566/** Function to start async_manager as a standalone fibril.
    570567 *
    571568 * 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.
    575570 */
    576571static int async_manager_fibril(void *arg)
     
    615610 * Notify the fibril which is waiting for this message, that it arrived
    616611 */
    617 static void reply_received(void *private, int retval,
    618                            ipc_call_t *data)
     612static void reply_received(void *private, int retval, ipc_call_t *data)
    619613{
    620614        amsg_t *msg = (amsg_t *) private;
     
    647641 */
    648642aid_t async_send_2(int phoneid, ipcarg_t method, ipcarg_t arg1, ipcarg_t arg2,
    649                    ipc_call_t *dataptr)
     643    ipc_call_t *dataptr)
    650644{
    651645        amsg_t *msg;
     
    674668 */
    675669aid_t async_send_3(int phoneid, ipcarg_t method, ipcarg_t arg1, ipcarg_t arg2,
    676                    ipcarg_t arg3, ipc_call_t *dataptr)
     670    ipcarg_t arg3, ipc_call_t *dataptr)
    677671{
    678672        amsg_t *msg;
     
    697691/** Wait for a message sent by async framework
    698692 *
    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.
    703696 */
    704697void async_wait_for(aid_t amsgid, ipcarg_t *retval)
     
    794787        futex_down(&async_futex);
    795788        insert_timeout(&msg->wdata);
    796         /* Leave locked async_futex when entering this function */
     789        /* Leave locked the async_futex when entering this function */
    797790        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()...*/
    799792        free(msg);
    800793}
    801794
    802 /** Set function that is called, IPC_M_CONNECT_ME_TO is received
    803  *
    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.
    805798 */
    806799void async_set_client_connection(async_client_conn_t conn)
Note: See TracChangeset for help on using the changeset viewer.