gpt4 book ai didi

c - 如何保护和取消保护单字节内存?

转载 作者:行者123 更新时间:2023-11-30 17:43:48 25 4
gpt4 key购买 nike

我知道mprotect是用来保护整个内存页的。谁能告诉我是否有办法保护和取消单个内存字节的保护?

最佳答案

如何保护?如果您正在寻找针对并发读取/权限的保护,则 pthread_mutex_t 就是您所寻找的。

http://www.sourceware.org/pthreads-win32/manual/pthread_mutex_init.html

正如评论中提到的,mprotect 用于整页。

关于c - 如何保护和取消保护单字节内存?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20173122/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com