diff options
author | IOhannes m zmölnig <zmoelnig@users.sourceforge.net> | 2013-04-14 20:40:07 +0000 |
---|---|---|
committer | IOhannes m zmölnig <zmoelnig@users.sourceforge.net> | 2013-04-14 20:40:07 +0000 |
commit | 99a8dbc12c1b61eecb798c1cb0fa2044c3344c23 (patch) | |
tree | ce21645425fb3b4580d13c5985fc04bdac01bdc1 /iemnet.h | |
parent | a911c2d49d12e1075fdd4c97a45c6fa2fcfdca8c (diff) |
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
Diffstat (limited to 'iemnet.h')
-rw-r--r-- | iemnet.h | 30 |
1 files changed, 30 insertions, 0 deletions
@@ -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 */ |