The dsynchandler is like a timerhandler BUT it synchronizes with other dsynchandlers (perhaps on different machines) such that they all emit their events at the same time. This is done without requiring that clocks be sychronized (e.g., NTP). The method used is to adapt the phase of all event emissions such that they converge. Each dsychhandler broadcasts to the other dsychhandlers on the same multicast group.
The is useful for triggering actions that need to be synchronized with each other but not to an absolute time.
NOTE: only the cycletime scheduling keyword is supported (not cron).
Wire keywords (standard handler keywords documented in Wire ):
set interrupt create event { name: "dsync(1sec)" priority: 1 } create handler dsync { interrupt: $interrupt cycletime: 1 }Events generated:
| Event Name | Type | Description |
|---|---|---|
| interrupt | AW_EVENT_TYPE_TIMESTAMP | It's time :) |
#include "monitor.h"
#include "wire.h"
#include "eventrxhandler.h"
#include "eventtxhandler.h"
Go to the source code of this file.
Data Structures | |
| struct | aw_dsynchandler_events_t |
| Events generated. More... | |
| struct | aw_dsynchandler_options_t |
| Options. More... | |
| struct | aw_dsynchandler_pdist_t |
| Phase Distribution. More... | |
| struct | aw_dsynchandler_t |
| Dsync handler object. More... | |
Defines | |
| #define | AW_DSYC_DEFAULT_MCAST_PORT 1800 |
| #define | AW_DSYNC_CONVERGENCE_ERROR (AW_TIMESTAMP_PER_SEC / 10) |
| #define | AW_DSYNC_DEFAULT_MCAST_GROUP "239.255.255.228" |
Functions | |
| aw_dsynchandler_t * | aw_create_dsynchandler (const aw_dsynchandler_events_t *events, aw_dsynchandler_options_t *options, const aw_alarm_sched_t *sched, aw_logger_t *logger, aw_monitor_t *mon) |
| Create a dsync handler. | |
| void | aw_free_dsynchandler (aw_dsynchandler_t *h) |
| Free handler and all associated resources. | |
| aw_handler_t * | aw_wire_dsynchandler (aw_wire_mkhandler_args_t *args) |
| Create a dsync handler using "wire". See header doc for keyword documentation. | |
|
|
|
|
|
|
|
|
|
|
||||||||||||||||||||||||
|
Create a dsync handler.
|
|
|
Free handler and all associated resources.
|
|
|
Create a dsync handler using "wire". See header doc for keyword documentation.
|