- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
如果它写入本地缓冲区,我可以在可重入函数中使用 sprintf 吗?像这样:
void reentrant_function () {
int i = 4;
char buffer[20];
snprintf(buffer, 20, "%d", i);
}
最佳答案
我来到这个页面是因为我也在问同样的问题。这是我从书上读到的:
UNIX 环境高级编程:第二版
Section 10.6
Most functions that are not in Figure 10.4 (a list of reentrant functions) are missing because (a) they are known to use static data structures, (b) they call malloc or free, or (c) they are part of the standard I/O library.
Linux 编程接口(interface)
Chapter 21.1.2
Functions can also be nonreentrant if they use static data structures for theirinternal bookkeeping. The most obvious examples of such functions are the membersof the stdio library (printf(), scanf(), and so on), which update internal datastructures for buffered I/O.
我想这取决于实现。这也取决于你如何实际使用 snprintf (缓冲区是必不可少的)。对该问题最安全的回答应该是“否”。
关于c++ - glibc sprintf 可以在可重入函数中使用吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4602574/
嗨,我已经阅读了 Java 中的 ReadWriteLock,但我不确定我是否掌握了它的重入部分。这是两个仅使用一个主线程来显示重入的简短代码示例 public class Locks { p
我在使用 NotifyIcons 时发现了一个重入问题。重现它真的很容易,只需在表单上放置一个 NotiftIcon,点击事件应该如下所示: private bool reentrancyDetect
我正在尝试使用 SQLite 的新 C 接口(interface)预更新 Hook : https://www.sqlite.org/c3ref/preupdate_count.html 现在回答我的
来自阅读here我发现 Actor 是可重入的,并且我希望以下情况成立:如果我有单一类型的转换 ThespianType 但有三个特定的 Actor ThespianType (T1、T2 和 T3)
有人可以向我解释一下 BlockReentrancy 的目的是什么吗?方法在ObservableCollection ? MSDN显示以下内容作为示例: //The typical usage is
我是一名优秀的程序员,十分优秀!