.\" Automatically generated by Pandoc 2.0.6 .\" .TH "PMEM2_GET_DRAIN_FN" "3" "2022-08-25" "PMDK - pmem2 API version 1.0" "PMDK Programmer's Manual" .hy .\" SPDX-License-Identifier: BSD-3-Clause .\" Copyright 2020, Intel Corporation .SH NAME .PP \f[B]pmem2_get_drain_fn\f[]() \- get a drain function .SH SYNOPSIS .IP .nf \f[C] #include\ typedef\ void\ (*pmem2_drain_fn)(void); struct\ pmem2_map; pmem2_drain_fn\ pmem2_get_drain_fn(struct\ pmem2_map\ *map); \f[] .fi .SH DESCRIPTION .PP The \f[B]pmem2_get_drain_fn\f[]() function returns a pointer to a function responsible for efficiently draining flushes (see \f[B]pmem2_get_flush_fn\f[](3)) in the range owned by \f[I]map\f[]. Draining, in this context, means making sure that the flushes before this operation won't be reordered after it. While it is not strictly true, draining can be thought of as waiting for previous flushes to complete. .PP If two (or more) mappings share the same drain function, it is safe to call this function once for all flushes belonging to those mappings. .SH RETURN VALUE .PP The \f[B]pmem2_get_drain_fn\f[]() function never returns NULL. .PP The \f[B]pmem2_get_drain_fn\f[]() for the same \f[I]map\f[] always returns the same function. This means that it's safe to cache its return value. However, this function is very cheap (because it returns a precomputed value), so caching may not be necessary. .SH SEE ALSO .PP \f[B]pmem2_get_flush_fn\f[](3), \f[B]pmem2_get_persist_fn\f[](3), \f[B]pmem2_map_new\f[](3), \f[B]libpmem2\f[](7) and \f[B]\f[]