gpt4 book ai didi

ios - 使用 SIGPIPE 和 SIG_IGN 的信号函数

转载 作者:可可西里 更新时间:2023-11-01 17:14:14 25 4
gpt4 key购买 nike

我加入了一个旧项目,我发现了这一行

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
signal(SIGPIPE, SIG_IGN);
....
}

我在文档中找到了这个:

/*
* For historical reasons; programs expect signal's return value to be
* defined by <sys/signal.h>.
*/

但我仍然对该行的目的感到困惑。

最佳答案

From Apple's documentation :

When a connection closes, by default, your process receives a SIGPIPE signal. If your program does not handle or ignore this signal, your program will quit immediately.

Ignore the signal globally with the following line of code:signal(SIGPIPE, SIG_IGN);

关于ios - 使用 SIGPIPE 和 SIG_IGN 的信号函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39551653/

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