为什么会出现这种输出
2$
3
4
5
6
7
8
9
10
代码:
#include<bits/stdc++.h>
inline void f(int a){ std::cout<<a<<"\n"; }
int main(){
std::ios::sync_with_stdio(false),std::cin.tie(nullptr),std::cout.tie(nullptr);
std::thread th[15];
for(int i=1;i<=10;i++) th[i]=std::thread(f,i);
for(int i=1;i<=10;i++){
th[i].join();
}
return 0;
}