table of contents
PMEM2_ASYNC(3) | PMDK Programmer's Manual | PMEM2_ASYNC(3) |
NAME¶
pmem2_config_set_vdm(), pmem2_memcpy_async(), pmem2_memmove_async(), pmem2_memset_async() - asynchronous data movement operations
SYNOPSIS¶
-
#define PMEM2_USE_MINIASYNC 1 #include <libpmem2.h> struct pmem2_future; int pmem2_config_set_vdm(struct pmem2_config *cfg, struct vdm *vdm); struct pmem2_future pmem2_memcpy_async(struct pmem2_map *map, void *pmemdest, const void *src, size_t len, unsigned flags); struct pmem2_future pmem2_memmove_async(struct pmem2_map *map, void *pmemdest, const void *src, size_t len, unsigned flags) struct pmem2_future pmem2_memset_async(struct pmem2_map *map, void *pmemstr, int c, size_t n, unsigned flags) {
DESCRIPTION¶
To use those functions, you must have libminiasync installed. Those functions use futures and vdm (virtual data mover) concepts from this library. Please check miniasync(7) for more details.
The struct pmem2_future is a structure describing a task to be done asynchronously taking into account persistence of the operation. It means that by the time the future is complete, all the data is safely written into a persistent domain.
The pmem2_config_set_vdm sets a vdm structure in the pmem2_config. This structure will be used by pmem2_*_async functions, to create a pmem2_future. If vdm is not set in the config, pmem2_map_new will use a default one which uses a pmem2 memory movement functions to perform memory operations. (pmem2_get_memcpy_fn(3), pmem2_get_memmove_fn(3), pmem2_get_memset_fn(3)).
The pmem2_memcpy_async uses vdm structure held inside the pmem2_map structure to initialise and returns pmem2_future. This future will perform memcpy operation defined in vdm to copy len bytes from src to pmemdest. In the current implementation flags are ignored.
The pmem2_memmove_async returns pmem2_future which will perform memmove operation defined in vdm to copy len bytes from src to pmemdest. In the current implementation flags are ignored.
The pmem2_memset_async returns pmem2_future which will perform memset operation defined in vdm to fill n bytes from pmemstr with value of int c interpreted as unsigned char. In the current implementation flags are ignored.
RETURN VALUE¶
The pmem2_config_set_vdm always return 0.
The pmem2_memcpy_async returns a new instance of pmem2_future performing memcpy operation. You can execute returned structure using methods from the libminiasync() library such as FUTURE_BUSY_POLL(3).
The pmem2_memmove_async returns a new instance of pmem2_future performing memmove operation.
The pmem2_memset_async returns a new instance of pmem2_future performing memset operation.
SEE ALSO¶
memcpy(3), memmove(3), memset(3), pmem2_get_drain_fn(3), pmem2_get_memcpy_fn(3), pmem2_get_memset_fn(3), pmem2_map_new(3), pmem2_get_persist_fn(3), vdm_memcpy(3), miniasync(7), miniasync_future(7), libpmem2(7) and <https://pmem.io>
2022-08-25 | PMDK - pmem2 API version 1.0 |