Next: Pitfalls
Up: Synchrony
Previous: Synchronizing clients
  Contents
Synchronous variables
Synchronous variables are updated only when a call to DICE_sync()
is made.
You can create them using:
-
- int DICE_sync_new ( char *name, char *type, void *value );
where name is the variable name (case sensitive, any string),
type is the variable type (see section 2.3; if the
type was not registered, it's automatically done so), and value
is the variable value. Note that the variable will only be available
after you call DICE_sync(). You can only free or alter the
value after you call DICE_sync 3.1, since only then DICElib makes a copy of it.
You can delete the variable using:
-
- int DICE_sync_delete ( char *name );
the function cares to free the variable value.
To update variables with a new value, call:
-
- int DICE_sync_update ( char *name, void *value );
Remember, the update will be scheduled and done only after the next
call to DICE_sync(). The previous value is automatically
freed once the update is made.
-
- void *DICE_sync_get ( char *name );
This function returns the variable's value, cast to void *.
You must always use this function to access the new value after calling
DICE_sync(), since the variable value may have changed.
-
- void *DICE_sync_get_next ( char *name );
This function returns the value that is scheduled for update, or NULL
if none.
Next: Pitfalls
Up: Synchrony
Previous: Synchronizing clients
  Contents
2001-12-09