Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/include/async.h

    r8869f7b r93ad49a8  
    4242#include <ipc/common.h>
    4343#include <fibril.h>
    44 #include <fibril_synch.h>
    4544#include <sys/time.h>
    4645#include <atomic.h>
     
    5352typedef void (*async_client_data_dtor_t)(void *);
    5453
    55 typedef void (*async_client_conn_t)(ipc_callid_t, ipc_call_t *);
     54/** Client connection handler
     55 *
     56 * @param callid ID of incoming call or 0 if connection initiated from
     57 *               inside using async_connect_to_me()
     58 * @param call   Incoming call or 0 if connection initiated from inside
     59 * @param arg    Local argument passed from async_new_connection() or
     60 *               async_connect_to_me()
     61 */
     62typedef void (*async_client_conn_t)(ipc_callid_t, ipc_call_t *, void *);
     63
     64/** Interrupt handler */
     65typedef void (*async_interrupt_handler_t)(ipc_callid_t, ipc_call_t *);
    5666
    5767/** Exchange management style
     
    8595} exch_mgmt_t;
    8696
    87 /** Session data */
    88 typedef struct {
    89         /** List of inactive exchanges */
    90         link_t exch_list;
    91        
    92         /** Exchange management style */
    93         exch_mgmt_t mgmt;
    94        
    95         /** Session identification */
    96         int phone;
    97        
    98         /** First clone connection argument */
    99         sysarg_t arg1;
    100        
    101         /** Second clone connection argument */
    102         sysarg_t arg2;
    103        
    104         /** Third clone connection argument */
    105         sysarg_t arg3;
    106        
    107         /** Exchange mutex */
    108         fibril_mutex_t mutex;
    109        
    110         /** Number of opened exchanges */
    111         atomic_t refcnt;
    112 } async_sess_t;
    113 
    114 /** Exchange data */
    115 typedef struct {
    116         /** Link into list of inactive exchanges */
    117         link_t sess_link;
    118        
    119         /** Link into global list of inactive exchanges */
    120         link_t global_link;
    121        
    122         /** Session pointer */
    123         async_sess_t *sess;
    124        
    125         /** Exchange identification */
    126         int phone;
    127 } async_exch_t;
     97/** Forward declarations */
     98struct _async_exch;
     99struct _async_sess;
     100
     101typedef struct _async_sess async_sess_t;
     102typedef struct _async_exch async_exch_t;
    128103
    129104extern atomic_t threads_in_ipc_wait;
     
    165140extern int async_wait_timeout(aid_t, sysarg_t *, suseconds_t);
    166141
    167 extern fid_t async_new_connection(sysarg_t, sysarg_t, ipc_callid_t,
    168     ipc_call_t *, async_client_conn_t);
     142extern fid_t async_new_connection(task_id_t, sysarg_t, ipc_callid_t,
     143    ipc_call_t *, async_client_conn_t, void *);
    169144
    170145extern void async_usleep(suseconds_t);
     
    175150extern void async_set_client_data_destructor(async_client_data_dtor_t);
    176151extern void *async_get_client_data(void);
     152extern void *async_get_client_data_by_id(task_id_t);
     153extern void async_put_client_data_by_id(task_id_t);
    177154
    178155extern void async_set_client_connection(async_client_conn_t);
    179 extern void async_set_interrupt_received(async_client_conn_t);
     156extern void async_set_interrupt_received(async_interrupt_handler_t);
    180157
    181158/*
     
    351328
    352329extern int async_connect_to_me(async_exch_t *, sysarg_t, sysarg_t, sysarg_t,
    353     async_client_conn_t);
     330    async_client_conn_t, void *);
    354331
    355332extern int async_hangup(async_sess_t *);
     
    358335extern async_exch_t *async_exchange_begin(async_sess_t *);
    359336extern void async_exchange_end(async_exch_t *);
     337
     338/*
     339 * FIXME These functions just work around problems with parallel exchange
     340 * management. Proper solution needs to be implemented.
     341 */
     342void async_sess_args_set(async_sess_t *sess, sysarg_t, sysarg_t, sysarg_t);
    360343
    361344/*
     
    466449extern async_sess_t *async_callback_receive_start(exch_mgmt_t, ipc_call_t *);
    467450
     451extern int async_state_change_start(async_exch_t *, sysarg_t, sysarg_t,
     452    sysarg_t, async_exch_t *);
     453extern bool async_state_change_receive(ipc_callid_t *, sysarg_t *, sysarg_t *,
     454    sysarg_t *);
     455extern int async_state_change_finalize(ipc_callid_t, async_exch_t *);
     456
     457extern void *async_remote_state_acquire(async_sess_t *);
     458extern void async_remote_state_update(async_sess_t *, void *);
     459extern void async_remote_state_release(async_sess_t *);
     460extern void async_remote_state_release_exchange(async_exch_t *);
     461
    468462#endif
    469463
Note: See TracChangeset for help on using the changeset viewer.