IPC: add job_add() API to the poll abstraction.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
This commit is contained in:
Angus Salkeld 2010-10-19 14:01:37 +10:00
parent cdc953384f
commit 36d1171e2a
3 changed files with 12 additions and 0 deletions

View File

@ -77,8 +77,12 @@ typedef int32_t (*qb_ipcs_dispatch_mod_fn)(enum qb_loop_priority p,
qb_ipcs_dispatch_fn_t fn);
typedef int32_t (*qb_ipcs_dispatch_del_fn)(int32_t fd);
typedef int32_t (*qb_ipcs_job_add_fn)(enum qb_loop_priority p,
void *data,
qb_loop_job_dispatch_fn dispatch_fn);
struct qb_ipcs_poll_handlers {
qb_ipcs_job_add_fn job_add;
qb_ipcs_dispatch_add_fn dispatch_add;
qb_ipcs_dispatch_mod_fn dispatch_mod;
qb_ipcs_dispatch_del_fn dispatch_del;

View File

@ -71,6 +71,7 @@ void qb_ipcs_poll_handlers_set(qb_ipcs_service_pt pt,
qb_hdb_handle_get(&qb_ipc_services, pt, (void **)&s);
s->poll_fns.job_add = handlers->job_add;
s->poll_fns.dispatch_add = handlers->dispatch_add;
s->poll_fns.dispatch_mod = handlers->dispatch_mod;
s->poll_fns.dispatch_del = handlers->dispatch_del;

View File

@ -232,6 +232,11 @@ static int32_t my_g_dispatch_del(int32_t fd)
#endif /* HAVE_GLIB */
static int32_t my_job_add(enum qb_loop_priority p, void *data, qb_loop_job_dispatch_fn fn)
{
return qb_loop_job_add(bms_loop, p, data, fn);
}
static int32_t my_dispatch_add(enum qb_loop_priority p, int32_t fd, int32_t evts,
void *data, qb_ipcs_dispatch_fn_t fn)
{
@ -262,12 +267,14 @@ int32_t main(int32_t argc, char *argv[])
.connection_destroyed = s1_connection_destroyed_fn,
};
struct qb_ipcs_poll_handlers ph = {
.job_add = my_job_add,
.dispatch_add = my_dispatch_add,
.dispatch_mod = my_dispatch_mod,
.dispatch_del = my_dispatch_del,
};
#ifdef HAVE_GLIB
struct qb_ipcs_poll_handlers glib_ph = {
.job_add = NULL, // FIXME
.dispatch_add = my_g_dispatch_add,
.dispatch_mod = my_g_dispatch_mod,
.dispatch_del = my_g_dispatch_del,