Multithreading Qt事件侦听器是否占用文件句柄?
在运行Qt应用程序的服务器上,当其他备份作业在夜间开始运行时,我出现以下错误:Multithreading Qt事件侦听器是否占用文件句柄?,multithreading,qt,unix,signals,Multithreading,Qt,Unix,Signals,在运行Qt应用程序的服务器上,当其他备份作业在夜间开始运行时,我出现以下错误: QEventDispatcherUNIXPrivate(): Unable to create thread pipe: Too many open files QEventDispatcherUNIXPrivate(): Can not continue without a thread pipe connect函数是否可能需要“unix文件句柄”?例如,如果我执行以下操作,是否需要从操作系统获取额外的文件句柄资
QEventDispatcherUNIXPrivate(): Unable to create thread pipe: Too many open files
QEventDispatcherUNIXPrivate(): Can not continue without a thread pipe
connect函数是否可能需要“unix文件句柄”?例如,如果我执行以下操作,是否需要从操作系统获取额外的文件句柄资源,直到断开连接
connect(this, SIGNAL(sendConfig(QString, QString)), deviceCon, SLOT(setDeviceConfig(QString, QString)));
emit sendConfig(configEntry, configValue);
disconnect(this, SIGNAL(sendConfig(QString, QString)), deviceCon, SLOT(setDeviceConfig(QString, QString)));
谢谢。
斯派奇关于这个问题,我能找到的最好的答案就是这本参考书 你的问题的答案是肯定的。该类打开一个管道,创建文件句柄,然后在
select
中使用这些句柄来处理事件
p.S.刚刚确认了4.8中类似的方法,所以,如果我理解正确:如果我为一个新线程调用connect()五次(没有disconnect()调用),每个新线程将使用多达6个文件句柄(一个用于自身,一个用于每个侦听信号句柄)。甚至每个connect()有两个文件句柄?意味着11个文件句柄?不,它不是为每个dispatcher对象创建一个管道。因此,如果您有一个具有多个连接线程的调度程序,那么FD的数量仍然是2