@@ -38,6 +38,13 @@ namespace api
3838// ! are that a lot of memory is being used by the temporary
3939// ! copy of the data to be persisted.
4040// !
41+ // ! Persistence happens in a background thread and further
42+ // ! persistence requests via the startBackgroundPersist*() methods
43+ // ! will be rejected if the background thread is executing.
44+ // ! However, calls to startBackgroundPersist() and
45+ // ! startBackgroundPersistIfAppropriate() are not thread safe and
46+ // ! must not be made concurrently.
47+ // !
4148// ! IMPLEMENTATION DECISIONS:\n
4249// ! This class expects to call a persistence function taking
4350// ! just the data adder as an argument. It's easy to wrap up
@@ -98,9 +105,15 @@ class API_EXPORT CBackgroundPersister : private core::CNonCopyable
98105 // ! called.
99106 bool firstProcessorPeriodicPersistFunc (const TFirstProcessorPeriodicPersistFunc &firstProcessorPeriodicPersistFunc);
100107
101- // ! Check whether a background persist is appropriate now, and if it is
102- // ! then start it by calling the first processor periodic persist
103- // ! function.
108+ // ! Start a background persist is one is not running.
109+ // ! Calls the first processor periodic persist function first.
110+ // ! Concurrent calls to this method are not threadsafe.
111+ bool startBackgroundPersist (void );
112+
113+ // ! If the periodic persist interval has passed since the last persist
114+ // ! then it is appropriate to persist now. Start it by calling the
115+ // ! first processor periodic persist function.
116+ // ! Concurrent calls to this method are not threadsafe.
104117 bool startBackgroundPersistIfAppropriate (void );
105118
106119 private:
@@ -121,6 +134,10 @@ class API_EXPORT CBackgroundPersister : private core::CNonCopyable
121134 };
122135
123136 private:
137+ // ! Persist in the background setting the last persist time
138+ // ! to timeOfPersistence
139+ bool startBackgroundPersist (core_t ::TTime timeOfPersistence);
140+
124141 // ! When this function is called a background persistence will be
125142 // ! triggered unless there is already one in progress.
126143 bool startPersist (void );
0 commit comments