これは私のコードを単純化したものです。
for(int i = 0; i < 500; i++) {
someMethod(i);
}
someMethod()
実行に時間がかかるため、マルチスレッドを使用してforループを100の5つの間隔に分割します。
for(int i = 0; i < 100; i++) {
someMethod(i);
}
for(int i = 100; i < 200; i++) {
someMethod(i);
}
...
for(int i = 400; i < 500; i++) {
someMethod(i);
}
だから私はsomeMethod()
異なるに対して同時に実行することができi
ます。
これを実現するためにマルチスレッドを使用するにはどうすればよいですか?
助けてください!ありがとう!