Changeset 953769f in mainline for uspace/lib/libc/generic/async.c


Ignore:
Timestamp:
2009-06-15T21:51:50Z (15 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
103e7d7
Parents:
ef8bcc6
Message:

Handle pending input using only one fibril.
Relax serialization in console, keep your fingers crossed.
Do not create a new "pending" fibril after each received call.

File:
1 edited

Legend:

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

    ref8bcc6 r953769f  
    179179static void default_client_connection(ipc_callid_t callid, ipc_call_t *call);
    180180static void default_interrupt_received(ipc_callid_t callid, ipc_call_t *call);
    181 static void default_pending(void);
    182181
    183182/**
     
    191190 */
    192191static async_client_conn_t interrupt_received = default_interrupt_received;
    193 
    194 /**
    195  * Pointer to a fibril function that will be used to handle pending
    196  * operations.
    197  */
    198 static async_pending_t pending = default_pending;
    199192
    200193static hash_table_t conn_hash_table;
     
    376369       
    377370        fid_t fid = fibril_create(notification_fibril, msg);
    378         fibril_add_ready(fid);
    379        
    380         futex_up(&async_futex);
    381         return true;
    382 }
    383 
    384 /** Pending fibril.
    385  *
    386  * After each call the pending operations are executed in a separate
    387  * fibril. The function pending() is c.
    388  *
    389  * @param arg Unused.
    390  *
    391  * @return Always zero.
    392  *
    393  */
    394 static int pending_fibril(void *arg)
    395 {
    396         pending();
    397        
    398         return 0;
    399 }
    400 
    401 /** Process pending actions.
    402  *
    403  * A new fibril is created which would process the pending operations.
    404  *
    405  * @return False if an error occured.
    406  *         True if the execution was passed to the pending fibril.
    407  *
    408  */
    409 static bool process_pending(void)
    410 {
    411         futex_down(&async_futex);
    412        
    413         fid_t fid = fibril_create(pending_fibril, NULL);
    414371        fibril_add_ready(fid);
    415372       
     
    514471}
    515472
    516 /** Default fibril function that gets called to handle pending operations.
    517  *
    518  * This function is defined as a weak symbol - to be redefined in user code.
    519  *
    520  */
    521 static void default_pending(void)
    522 {
    523 }
    524 
    525473/** Wrapper for client connection fibril.
    526474 *
     
    661609       
    662610out:
    663         process_pending();
     611        ;
    664612}
    665613
     
    1050998}
    1051999
    1052 /** Setter for pending function pointer.
    1053  *
    1054  * @param pend Function that will implement a new pending
    1055  *             operations fibril.
    1056  */
    1057 void async_set_pending(async_pending_t pend)
    1058 {
    1059         pending = pend;
    1060 }
    1061 
    10621000/** Pseudo-synchronous message sending - fast version.
    10631001 *
Note: See TracChangeset for help on using the changeset viewer.