~vojtech-horky/helenos/numa

« back to all changes in this revision

Viewing changes to uspace/lib/c/include/async.h

  • Committer: Vojtech Horky
  • Date: 2011-09-28 15:13:08 UTC
  • mfrom: (538.1.714 helenos-mainline)
  • Revision ID: vojtechhorky@users.sourceforge.net-20110928151308-2pz4s2w035n48o8a
Merge mainline changes

Conflicts fixed without problems (mostly caused by separating
ABI into /abi/).

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
 
42
42
#include <ipc/common.h>
43
43
#include <fibril.h>
44
 
#include <fibril_synch.h>
45
44
#include <sys/time.h>
46
45
#include <atomic.h>
47
46
#include <bool.h>
95
94
        EXCHANGE_SERIALIZE
96
95
} exch_mgmt_t;
97
96
 
98
 
/** Session data */
99
 
typedef struct {
100
 
        /** List of inactive exchanges */
101
 
        list_t exch_list;
102
 
        
103
 
        /** Exchange management style */
104
 
        exch_mgmt_t mgmt;
105
 
        
106
 
        /** Session identification */
107
 
        int phone;
108
 
        
109
 
        /** First clone connection argument */
110
 
        sysarg_t arg1;
111
 
        
112
 
        /** Second clone connection argument */
113
 
        sysarg_t arg2;
114
 
        
115
 
        /** Third clone connection argument */
116
 
        sysarg_t arg3;
117
 
        
118
 
        /** Exchange mutex */
119
 
        fibril_mutex_t mutex;
120
 
        
121
 
        /** Number of opened exchanges */
122
 
        atomic_t refcnt;
123
 
} async_sess_t;
 
97
/** Forward declarations */
 
98
struct async_exch;
 
99
struct async_sess;
124
100
 
125
 
/** Exchange data */
126
 
typedef struct {
127
 
        /** Link into list of inactive exchanges */
128
 
        link_t sess_link;
129
 
        
130
 
        /** Link into global list of inactive exchanges */
131
 
        link_t global_link;
132
 
        
133
 
        /** Session pointer */
134
 
        async_sess_t *sess;
135
 
        
136
 
        /** Exchange identification */
137
 
        int phone;
138
 
} async_exch_t;
 
101
typedef struct async_sess async_sess_t;
 
102
typedef struct async_exch async_exch_t;
139
103
 
140
104
extern atomic_t threads_in_ipc_wait;
141
105
 
175
139
extern void async_wait_for(aid_t, sysarg_t *);
176
140
extern int async_wait_timeout(aid_t, sysarg_t *, suseconds_t);
177
141
 
178
 
extern fid_t async_new_connection(sysarg_t, sysarg_t, ipc_callid_t,
 
142
extern fid_t async_new_connection(task_id_t, sysarg_t, ipc_callid_t,
179
143
    ipc_call_t *, async_client_conn_t, void *);
180
144
 
181
145
extern void async_usleep(suseconds_t);
185
149
extern void async_set_client_data_constructor(async_client_data_ctor_t);
186
150
extern void async_set_client_data_destructor(async_client_data_dtor_t);
187
151
extern 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);
188
154
 
189
155
extern void async_set_client_connection(async_client_conn_t);
190
156
extern void async_set_interrupt_received(async_interrupt_handler_t);
370
336
extern void async_exchange_end(async_exch_t *);
371
337
 
372
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);
 
343
 
 
344
/*
373
345
 * User-friendly wrappers for async_share_in_start().
374
346
 */
375
347
 
476
448
extern async_sess_t *async_callback_receive(exch_mgmt_t);
477
449
extern async_sess_t *async_callback_receive_start(exch_mgmt_t, ipc_call_t *);
478
450
 
 
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
 
479
462
#endif
480
463
 
481
464
/** @}