Mark object as modified¶
ss_pers_modified
is a function defined in sspers.c.
Synopsis:
-
herr_t
ss_pers_modified
(ss_pers_t *pers, unsigned flags)¶
Formal Arguments:
pers
: Persistent object to mark as modifiedflags
: Bitflags such as SS_ALLSAME
Description: If a persistent object is modified then it should also be marked as such by invoking this function. If all
tasks modify the persistent object in the same manner then the second argument can be SS_ALLSAME, otherwise it
should be zero. The SS_PERS_MODIFIED macro is a convenience for this function since the client is often
passing a subclass of ss_pers_t
and may get compiler warnings.
The client can call this function either before or after making a modification to the object, but it’s generally safer to make this call first so that the object is marked as modified even if the modification is interrupted by an error. It doesn’t hurt to mark an object as modified and then not actually modify it – it just causes the synchronization algorithm to take longer to discover that there weren’t any changes.
The `dirty’ flag is always set to true to indicate that the object’s new value differs (or is about to differ) from what is stored in the file.
If flags
has the SS_ALLSAME bit set then the client is indicating that all tasks belonging to the scope have
(or will) make identical modifications. In this case, if the object’s synced’ flag is set we promote it to
:ref:`SS_ALLSAME <SS> to indicate that the object is synchronized but its sync_cksum
and sync_serial
values are outdated.
Otherwise the object’s `synced’ flag is set to false.
Return Value: Returns non-negative on success; negative on failure.
Parallel Notes: Independent
Issues: We should really check whether the scope owning the object is read-only, otherwise we won’t get any indication of an error until we try to synchronize.
See Also:
- SS_PERS_MODIFIED: 7.29: Mark object as modified
- Persistent Objects: Introduction for current chapter