提交 4bb002c4 编写于 作者: T Tristan Matthews 提交者: jp9000

UI: Block SIGPIPE in all threads

This can happen when trying to write to a closed socket (in the case
of an RTMP server closing the connection).
上级 94c881b8
......@@ -50,6 +50,7 @@
#include <windows.h>
#else
#include <signal.h>
#include <pthread.h>
#endif
#include <iostream>
......@@ -2245,6 +2246,18 @@ int main(int argc, char *argv[])
sig_handler.sa_flags = 0;
sigaction(SIGINT, &sig_handler, NULL);
/* Block SIGPIPE in all threads, this can happen if a thread calls write on
a closed pipe. */
sigset_t sigpipe_mask;
sigemptyset(&sigpipe_mask);
sigaddset(&sigpipe_mask, SIGPIPE);
sigset_t saved_mask;
if (pthread_sigmask(SIG_BLOCK, &sigpipe_mask, &saved_mask) == -1) {
perror("pthread_sigmask");
exit(1);
}
#endif
#ifdef _WIN32
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册