---
name: "pmem2_async"
section: "3"
platform: "linux"
package: "libpmem2-dev"
version: "1.13.1-1.1+b1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/pmem2_async"
---

# pmem2\_async(3)

asynchronous data movement operations

## 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.

## 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_memcpy_fn/3.md), [**pmem2\_get\_memmove\_fn**(3)](/pmem2_get_memmove_fn/3.md), [**pmem2\_get\_memset\_fn**(3)](/pmem2_get_memset_fn/3.md)).

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)](/memcpy/3.md), [**memmove**(3)](/memmove/3.md), [**memset**(3)](/memset/3.md), [**pmem2\_get\_drain\_fn**(3)](/pmem2_get_drain_fn/3.md), [**pmem2\_get\_memcpy\_fn**(3)](/pmem2_get_memcpy_fn/3.md), [**pmem2\_get\_memset\_fn**(3)](/pmem2_get_memset_fn/3.md), [**pmem2\_map\_new**(3)](/pmem2_map_new/3.md), [**pmem2\_get\_persist\_fn**(3)](/pmem2_get_persist_fn/3.md), **vdm\_memcpy**(3), **miniasync**(7), **miniasync\_future**(7), [**libpmem2**(7)](/libpmem2/7.md) and **\<https://pmem.io\>**
