PMEM2_GET_DRAIN_FN(3)
β¨ pmem2_get_drain_fn() β get a drain function β¨
okay bestie, welcome to the PMDK Programmer's Manual π this one's a lil baby page but it's IMPORTANT, so grab your iced coffee and let's go π§
πΈ NAME πΈ
pmem2_get_drain_fn() β get a drain function
π SYNOPSIS π
#include <libpmem2.h>
typedef void (*pmem2_drain_fn)(void);
struct pmem2_map;
pmem2_drain_fn pmem2_get_drain_fn(struct pmem2_map *map);
π DESCRIPTION π
so. pmem2_get_drain_fn() hands you back a pointer to a function β and that function's whole job is to drain flushes efficiently (the flushes from pmem2_get_flush_fn(3), iykyk) in the range that map owns. π
and what does "draining" even mean here, bestie? it means making sure the flushes that happened before this operation don't get reordered to after it. periodt. π₯
ngl it's not strictly true, but you can lowkey think of draining as just waiting for the previous flushes to finish. that's the vibe. β¨
also β and this is the good part β 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. no cap. π«Ά
π RETURN VALUE π
pmem2_get_drain_fn() never returns NULL. not ever. ππ
and for the same map, it always returns the same function. which means it's totally safe to cache its return value, bestie β go off. π
that saidβ¦ this function is very cheap (it just returns a precomputed value, main character behavior honestly), so caching might not even be necessary. your call. π¦
β SEE ALSO β
π and that's the whole page, bestie β go drain those flushes and slay π
this icon was brought to you by PMDK, dated 2025-07-24 β mwah, catch you in the next manpage ππΈβ¨
π¦ where this page comes from
- fedora 43: libpmem2-devel 2.1.0-4.fc43 Β· BSD-3-Clause
- π the page's license: BSD-3-Clause
- Copyright 2020, Intel Corporation
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms