BFS を使用した Travse ディレクトリ構造 (Igor が述べたように)。
ディレクトリに到達したら、スレッドを開始して、ディレクトリ内のすべてのファイルを一覧表示します。
そして、ファイルの一覧表示/走査が終了したら、スレッドを強制終了します。
そのため、ファイルを一覧表示するために、ディレクトリごとに個別のスレッドがあります。
例:
root
- d1
- d1.1
- d1.2
- f1.1 ... f1.100
- d2
- d2.1
- d2.2
- d2.3
- f2.1 ... f2.200
- d3
....
OUTPUTは次のようになります ->
got d1
started thread to get files of d1
got d2
started thread to get files of d1
done with files in d1
got d3
started thread to get files of d1
got d1.1
started thread to get files of d1.1
got d1.2
started thread to get files of d1.2
したがって、ディレクトリの深さを探索するために戻ってくるまでに、ファイルを取得するためのスレッドはその仕事を (ほぼ) 終了しています。
これが役に立てば幸いです。