Ignore:
File:
1 edited

Legend:

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

    r93ad49a8 r8869f7b  
    4242#include <ipc/common.h>
    4343#include <fibril.h>
     44#include <fibril_synch.h>
    4445#include <sys/time.h>
    4546#include <atomic.h>
     
    5253typedef void (*async_client_data_dtor_t)(void *);
    5354
    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  */
    62 typedef void (*async_client_conn_t)(ipc_callid_t, ipc_call_t *, void *);
    63 
    64 /** Interrupt handler */
    65 typedef void (*async_interrupt_handler_t)(ipc_callid_t, ipc_call_t *);
     55typedef void (*async_client_conn_t)(ipc_callid_t, ipc_call_t *);
    6656
    6757/** Exchange management style
     
    9585} exch_mgmt_t;
    9686
    97 /** Forward declarations */
    98 struct _async_exch;
    99 struct _async_sess;
    100 
    101 typedef struct _async_sess async_sess_t;
    102 typedef struct _async_exch async_exch_t;
     87/** Session data */
     88typedef 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 */
     115typedef 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;
    103128
    104129extern atomic_t threads_in_ipc_wait;
     
    140165extern int async_wait_timeout(aid_t, sysarg_t *, suseconds_t);
    141166
    142 extern fid_t async_new_connection(task_id_t, sysarg_t, ipc_callid_t,
    143     ipc_call_t *, async_client_conn_t, void *);
     167extern fid_t async_new_connection(sysarg_t, sysarg_t, ipc_callid_t,
     168    ipc_call_t *, async_client_conn_t);
    144169
    145170extern void async_usleep(suseconds_t);
     
    150175extern void async_set_client_data_destructor(async_client_data_dtor_t);
    151176extern void *async_get_client_data(void);
    152 extern void *async_get_client_data_by_id(task_id_t);
    153 extern void async_put_client_data_by_id(task_id_t);
    154177
    155178extern void async_set_client_connection(async_client_conn_t);
    156 extern void async_set_interrupt_received(async_interrupt_handler_t);
     179extern void async_set_interrupt_received(async_client_conn_t);
    157180
    158181/*
     
    328351
    329352extern int async_connect_to_me(async_exch_t *, sysarg_t, sysarg_t, sysarg_t,
    330     async_client_conn_t, void *);
     353    async_client_conn_t);
    331354
    332355extern int async_hangup(async_sess_t *);
     
    335358extern async_exch_t *async_exchange_begin(async_sess_t *);
    336359extern 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  */
    342 void async_sess_args_set(async_sess_t *sess, sysarg_t, sysarg_t, sysarg_t);
    343360
    344361/*
     
    449466extern async_sess_t *async_callback_receive_start(exch_mgmt_t, ipc_call_t *);
    450467
    451 extern int async_state_change_start(async_exch_t *, sysarg_t, sysarg_t,
    452     sysarg_t, async_exch_t *);
    453 extern bool async_state_change_receive(ipc_callid_t *, sysarg_t *, sysarg_t *,
    454     sysarg_t *);
    455 extern int async_state_change_finalize(ipc_callid_t, async_exch_t *);
    456 
    457 extern void *async_remote_state_acquire(async_sess_t *);
    458 extern void async_remote_state_update(async_sess_t *, void *);
    459 extern void async_remote_state_release(async_sess_t *);
    460 extern void async_remote_state_release_exchange(async_exch_t *);
    461 
    462468#endif
    463469
Note: See TracChangeset for help on using the changeset viewer.