From 99a8dbc12c1b61eecb798c1cb0fa2044c3344c23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig?= Date: Sun, 14 Apr 2013 20:40:07 +0000 Subject: simple notification abstraction last implementation used another thread that called clock_set() in a sys_lock(). this implementation uses a pipe and sys_addpollfn() svn path=/trunk/externals/iem/iemnet/; revision=17089 --- iemnet.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'iemnet.h') diff --git a/iemnet.h b/iemnet.h index 93204cf..9ee1394 100644 --- a/iemnet.h +++ b/iemnet.h @@ -149,6 +149,36 @@ void iemnet__receiver_destroy(t_iemnet_receiver*); int iemnet__receiver_getsize(t_iemnet_receiver*); +/** + * opaque data type used for a notification server + */ +typedef struct _iemnet_notifier t_iemnet_notifier; +EXTERN_STRUCT _iemnet_notifier; +t_iemnet_notifier*iemnet__notify_create(void); +void iemnet__notify_destroy(t_iemnet_notifier*x); + +/** + * opaque data type used for a notification client + */ +typedef struct _iemnet_notify t_iemnet_notify; +EXTERN_STRUCT _iemnet_notify; +void iemnet__notify_remove(t_iemnet_notify*notify); +/** + * callback function from main thread on notification + */ +typedef void (*t_iemnet_notifun)(void *data); +/** + * register a new notification callback with the 'notifier' server. + * on success, returns a notification client to be passed to iemnet__notify() + * on failure, returns NULL + */ +t_iemnet_notify*iemnet__notify_add(t_iemnet_notifier*notifier, t_iemnet_notifun fun, void*data); +/** + * tell mainthread that something happened with 'notify' client + * (will call the callback associated to 'notify' asap) + */ +void iemnet__notify(t_iemnet_notify*notify); + /* convenience functions */ -- cgit v1.2.1