summaryrefslogtreecommitdiffstats
path: root/src/account/indication_common.h
diff options
context:
space:
mode:
authorTomas Bzatek <tbzatek@redhat.com>2013-11-01 17:05:22 +0100
committerTomas Bzatek <tbzatek@redhat.com>2013-11-04 13:42:20 +0100
commit1cc65739b1ce02e2565813bf70716a7e9de277ec (patch)
treeb758b8686c81d5cd764e90ee4999fbcf69167dce /src/account/indication_common.h
parent03204e963d2a6a179ff725348ea76ced0e50228b (diff)
downloadopenlmi-providers-1cc65739b1ce02e2565813bf70716a7e9de277ec.tar.gz
openlmi-providers-1cc65739b1ce02e2565813bf70716a7e9de277ec.tar.xz
openlmi-providers-1cc65739b1ce02e2565813bf70716a7e9de277ec.zip
account: Start watching right upon indication subscription
This is an attempt to get rid of most probable race conditions by creating inotify watches outside the watcher thread and making them persistent for the whole time the indication subscription is active. There's a certain amount of time when watching if off due to gather part of the indication manager. Leaving a watch fd open with active watches allows us to queue events that we process next time the watcher is called (once gather part is finished).
Diffstat (limited to 'src/account/indication_common.h')
-rw-r--r--src/account/indication_common.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/account/indication_common.h b/src/account/indication_common.h
index d2727dc..6b7bc6d 100644
--- a/src/account/indication_common.h
+++ b/src/account/indication_common.h
@@ -18,6 +18,13 @@
* Authors: Roman Rakus <rrakus@redhat.com>
*/
+typedef struct {
+ int wd_pwd, wd_grp;
+ int inotify_fd;
+ struct timespec last_pwd, last_grp;
+} AccountIndication;
bool filter_checker(const CMPISelectExp *filter);
-bool watcher(void **data);
+bool watcher_init(AccountIndication *ind);
+bool watcher(AccountIndication *ind, void **data);
+void watcher_destroy(AccountIndication *ind);