Skip to content

Commit

Permalink
* Fixes: NB#253041 - Add functions to help global synchronisation
Browse files Browse the repository at this point in the history
    - Added new #defines
    - Explained "global synchronization" in iphb_wait() comments (IPHB_WAIT_GS_*)
    Note that no changes to the actual code has been done - only the new dines added.
  • Loading branch information
Raimo Vuonnala committed May 9, 2011
1 parent a7a36ed commit 5125ca1
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
9 changes: 9 additions & 0 deletions debian/changelog
@@ -1,3 +1,12 @@
libiphb (0.61.29) unstable; urgency=low

* Fixes: NB#253041 - Add functions to help global synchronisation
- Added new #defines
- Explained "global synchronization" in iphb_wait() comments (IPHB_WAIT_GS_*)
Note that no changes to the actual code has been done - only the new dines added.

-- Raimo Vuonnala <raimo.vuonnala@nokia.com> Mon, 09 May 2011 12:26:54 +0300

libiphb (0.61.28) unstable; urgency=low

* Added hbtest2
Expand Down
19 changes: 19 additions & 0 deletions iphbd/libiphb.h
Expand Up @@ -57,6 +57,22 @@ iphb_t iphb_open(int *dummy);



/**
"Global sync" predefined values (slots), see iphb_wait() function.
The timeline is divided into fixed" global slots (GS)" (all waiters for a certain slot
are woken up at the same time (also the lower-value waiters).
*/
#define IPHB_GS_WAIT_30_SEC 30 //!< 30 second wakeup slot
#define IPHB_GS_WAIT_1_MIN 60 //!< 1 minute wakeup slot, the user of the previous slot wakes here as well
#define IPHB_GS_WAIT_2_MIN (2*60) //!< 2 minute wakeup slot, the users of the previous slots wake here as well
#define IPHB_GS_WAIT_10_MIN (10*60) //!< 10 minute wakeup slot, the users of the previous slots wake here as well;
// you can use any multiplication of IPHB_GS_WAIT_10_MIN, although it
// is recommended to use these predefined values
#define IPHB_GS_WAIT_30_MIN (30*60) //!< 30 minute wakeup slot, the users of the previous slots wake here as well
#define IPHB_GS_WAIT_1_HOUR (60*60) //!< 1 hour wakeup slot, the users of the previous slots wake here as well
#define IPHB_GS_WAIT_2_HOURS (2*60*60) //!< 2 hours wakeup slot, the users of the previous slots wake here as well
#define IPHB_GS_WAIT_10_HOURS (10*60*60) //!< 10 hours wakeup slot, the users of the previous slots wake here as well



/**
Expand All @@ -67,6 +83,9 @@ iphb_t iphb_open(int *dummy);
@param mintime Time in seconds that MUST be waited before heartbeat is reacted to.
Value 0 means 'wake me up when someboy else is woken'
@param maxtime Time in seconds when the wait MUST end. It is wise to have maxtime-mintime quite big so all users of this service get synced.
It is also possible to use "global synchronization" by setting a IPHB_GS_WAIT_* value to
both mintime and maxtime (same value for both) - you will be waken up when the next proper slot
is fired.
@param must_wait 1 if this functions waits for heartbeat, 0 if you are going to use select/poll (see iphb_get_fd)
@return Time waited, (time_t)-1 if error (check errno)
Expand Down

0 comments on commit 5125ca1

Please sign in to comment.