PMEM2_ASYNC(3)
π pmem2_async(3) β PMDK Programmer's Manual π
okay bestie, gather round, because this one comes with a big heads-up before we even start π
π¨ NAME π¨
pmem2_config_set_vdm() (DEPRECATED), pmem2_memcpy_async() (DEPRECATED), pmem2_memmove_async() (DEPRECATED), pmem2_memset_async() (DEPRECATED) β asynchronous data movement operations
NOTICE: Support for async functions is deprecated since PMDK 1.13.0 release and will be removed in the PMDK 1.14.0 release along with the miniasync dependency. so likeβ¦ she's leaving, and we're sad, but we're also warned π
β¨ 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)
{
no cap, that last { is just sitting there living its truth π
πΈ DESCRIPTION πΈ
So here's the tea π β to use any of these functions, you must have libminiasync installed. These functions use futures and vdm (virtual data mover) concepts from that library. Slide over to miniasync(7) for the details, iykyk.
The struct pmem2_future is a structure describing a task to be done asynchronously, taking into account persistence of the operation. Which means: by the time the future is complete, all the data is safely written into a persistent domain. that's the whole point, and it ate π
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. And if vdm is not set in the config, pmem2_map_new will use a default one β one that uses pmem2 memory movement functions to perform memory operations: pmem2_get_memcpy_fn(3), pmem2_get_memmove_fn(3), pmem2_get_memset_fn(3). cute default behaviour honestly π
The pmem2_memcpy_async uses the vdm structure held inside the pmem2_map structure to initialise and returns a pmem2_future. This future will perform the 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 a pmem2_future which will perform the 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 a pmem2_future which will perform the memset operation defined in vdm to fill n bytes from pmemstr with the value of int c interpreted as unsigned char. In the current implementation flags are ignored π
π¦ RETURN VALUE π¦
- The
pmem2_config_set_vdmalways returns0. that's it, that's the answer, iconic consistency β¨ - The
pmem2_memcpy_asyncreturns a new instance ofpmem2_futureperforming thememcpyoperation. You can execute the returned structure using methods from thelibminiasync()library, such asFUTURE_BUSY_POLL(3). go off π₯ - The
pmem2_memmove_asyncreturns a new instance ofpmem2_futureperforming thememmoveoperation. - The
pmem2_memset_asyncreturns a new instance ofpmem2_futureperforming thememsetoperation.
π 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>
and that's the whole page, bestie π«Ά This one came out of the PMDK crew, dated 2023-05-31 β go forth and persist your data safely, main character energy only ππ
π¦ where this page comes from
- debian trixie: libpmem2-dev 1.13.1-1.1+b1 Β· BSD-3-Clause
- ubuntu noble: libpmem2-dev 1.13.1-1.1ubuntu2 Β· BSD-3-Clause
- ubuntu questing: libpmem2-dev 1.13.1-1.1ubuntu3
- ubuntu resolute: libpmem2-dev 1.13.1-1.1ubuntu4 Β· BSD-3-Clause
- ubuntu stonking: libpmem2-dev 1.13.1-1.1ubuntu5 Β· BSD-3-Clause
- π the page's license: BSD-3-Clause
- Copyright 2022, Intel Corporation
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms