diff --git a/libpurgeablemem/cpp/include/purgeable_mem_base.h b/libpurgeablemem/cpp/include/purgeable_mem_base.h index 1567e85e2f6c72037211f9ced5298bd39ea42849..7ea386d0fe5d083088a233c895fe09879647a7f8 100644 --- a/libpurgeablemem/cpp/include/purgeable_mem_base.h +++ b/libpurgeablemem/cpp/include/purgeable_mem_base.h @@ -39,6 +39,15 @@ public: * While return true if content recover success. * OS cannot reclaim the memory of the obj's content when this * function return true, until EndRead() is called. + * + * Attension: the return value must be recevied and handled, + * since the visiting of this object with the failure result + * will cause unsuspected result. + * For example: + * if (BeginRead()) { + * // visit this object + * EndRead(); + * } */ bool BeginRead(); @@ -50,13 +59,22 @@ public: void EndRead(); /* - * BeginRead: begin read the PurgeableMem obj. + * BeginRead: begin write the PurgeableMem obj. * Return: return true if the obj's content is present. * If content is purged(no present), system will recover its data, * return false if content is purged and recover failed. * While return true if content recover success. * OS cannot reclaim the memory of the obj's content when this - * function return true, until EndRead() is called. + * function return true, until EndWrite() is called. + * + * Attension: the return value must be recevied and handled, + * since the visiting of this object with the failure result + * will cause unsuspected result. + * For example: + * if (BeginWrite()) { + * // visit this object + * EndWrite(); + * } */ bool BeginWrite(); diff --git a/libpurgeablemem/interfaces/kits/c/purgeable_memory.h b/libpurgeablemem/interfaces/kits/c/purgeable_memory.h index a228044348e33e324aa8c5df8dbb9378534face3..6d87f517e461582397f9c5dfaddb6c73ec76920d 100644 --- a/libpurgeablemem/interfaces/kits/c/purgeable_memory.h +++ b/libpurgeablemem/interfaces/kits/c/purgeable_memory.h @@ -108,6 +108,15 @@ bool OH_PurgeableMemory_Destroy(OH_PurgeableMemory *purgObj); * OS cannot reclaim the memory of @purgObj's content when this * function return true, until PurgMemEndRead() is called. * + * Attension: the return value must be recevied and handled, + * since the visiting of this object with the failure result + * will cause unsuspected result. + * For example: + * if (OH_PurgeableMemory_BeginRead()) { + * // visit this object + * OH_PurgeableMemory_EndRead(); + * } + * * @since 10 * @version 1.0 */ @@ -138,6 +147,15 @@ void OH_PurgeableMemory_EndRead(OH_PurgeableMemory *purgObj); * OS cannot reclaim the memory of @purgObj's content when this * function return true, until PurgMemEndWrite() is called. * + * Attension: the return value must be recevied and handled, + * since the visiting of this object with the failure result + * will cause unsuspected result. + * For example: + * if (OH_PurgeableMemory_BeginWrite()) { + * // visit this object + * OH_PurgeableMemory_EndWrite(); + * } + * * @since 10 * @version 1.0 */