Utils::FileSystemWatcher Class
class Utils::FileSystemWatcherFileSystemWatcher 클래스는 내부적으로 중앙 집중식 QFileSystemWatcher 를 사용하고 Mac OS에서 제한을 적용하는 파일 감시기입니다. 더 보기...
| Header: | #include <FileSystemWatcher> |
| Inherits: | QObject |
공개 함수
| FileSystemWatcher(QObject *parent = nullptr) | |
| FileSystemWatcher(int id, QObject *parent = nullptr) |
상세 설명
설계 고려 사항
QFileSystemWatcher 의 생성/소멸에는 많은 비용이 듭니다. 중앙 집중식 감시기를 사용하면 이 문제를 해결할 수 있습니다.
참고: 생성자에 (임의의) 정수 id != 0을 전달하여 QFileSystemWatcher 의 여러 인스턴스를 생성하는것이 (여전히)가능합니다 . 이를 통해 운영 체제 한도를 쉽게 초과하는 감시자를 다른 감시자와 분리할 수 있습니다(아래 참조).
Mac OS 관련 사항
macOS에서는 프로세스당 한 번에 열 수 있는 파일 핸들 수에 엄격한 제한이 있습니다(예: ulimit -a 에 표시된 바와 같이, Mac OS X Snow Leopard Server에서는 2560개입니다). 감시할 디렉터리가 많은 .qmlproject 를 하나 또는 여러 개 열면 이 제한을 쉽게 초과하게 됩니다. 그 결과, 예를 들어 더 이상 스레드를 생성할 수 없게 되는 등의 상황에서 나중에 시스템이 충돌하게 됩니다.
이 클래스는 .qmlproject 파일에 사용되는 파일 시스템 감시기가 사용 가능한 파일 핸들 수의 절반 이상을 절대 사용하지 않도록 하는 휴리스틱을 구현합니다. 또한 rlim_cur 의 개수를 rlim_max 로 늘립니다. main.cpp의 기존 코드는 오류가 발생했으니,
의 마지막 섹션을 참조하십시오.
Copyright © The Qt Company Ltd. and other contributors. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.