PMEM2_MEMMOVE_ASYNC(3)

πŸ“¦
version 1.13.1 Β· 2 versions
, in debian trixie, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– 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_vdm always returns 0. that's it, that's the answer, iconic consistency ✨
  • The pmem2_memcpy_async returns a new instance of pmem2_future performing the memcpy operation. You can execute the returned structure using methods from the libminiasync() library, such as FUTURE_BUSY_POLL(3). go off πŸ”₯
  • The pmem2_memmove_async returns a new instance of pmem2_future performing the memmove operation.
  • The pmem2_memset_async returns a new instance of pmem2_future performing the 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>


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