diff options
author | Denis Kenzior <denkenz@gmail.com> | 2011-02-26 00:12:02 -0600 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2011-02-28 16:13:55 -0600 |
commit | 5ffe6f7beb1904a1ee745c925bac65f71e012994 (patch) | |
tree | 7c77417e27a8fc479a0f626aff8a26b3d791b8b4 /gatchat/gatio.c | |
parent | 3f2f11fe8fbe60729fd6a646cbbafd083013db15 (diff) | |
download | ofono-5ffe6f7beb1904a1ee745c925bac65f71e012994.tar.bz2 |
gatio: Add write 'done' notifier
This allows external clients to get notified when GAtIO no longer has a
registered write watcher. E.g. no more data is currently pending.
Diffstat (limited to 'gatchat/gatio.c')
-rw-r--r-- | gatchat/gatio.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/gatchat/gatio.c b/gatchat/gatio.c index 9d44a780..e6556200 100644 --- a/gatchat/gatio.c +++ b/gatchat/gatio.c @@ -52,6 +52,8 @@ struct _GAtIO { gpointer write_data; /* Write callback userdata */ GAtDebugFunc debugf; /* debugging output function */ gpointer debug_data; /* Data to pass to debug func */ + GAtDisconnectFunc write_done_func; + gpointer write_done_data; gboolean destroyed; /* Re-entrancy guard */ }; @@ -158,6 +160,12 @@ static void write_watcher_destroy_notify(gpointer user_data) io->write_watch = 0; io->write_handler = NULL; io->write_data = NULL; + + if (io->write_done_func) { + io->write_done_func(io->write_done_data); + io->write_done_func = NULL; + io->write_done_data = NULL; + } } static gboolean can_write_data(GIOChannel *channel, GIOCondition cond, @@ -370,3 +378,13 @@ gboolean g_at_io_set_debug(GAtIO *io, GAtDebugFunc func, gpointer user_data) return TRUE; } + +void g_at_io_set_write_done(GAtIO *io, GAtDisconnectFunc func, + gpointer user_data) +{ + if (io == NULL) + return; + + io->write_done_func = func; + io->write_done_data = user_data; +} |