Код: Выделить всё
void loadCell(FILE* fp)
{
char cbuf[12];
int clen = rand() % 100;
fseek(fp, clen, 0);
long blen = fread(cbuf, 1, 8, fp);
}
void thread_func() {
auto start = std::chrono::high_resolution_clock::now();
FILE* fp = fopen("./testfile", "r");
for (size_t i=0; i
Подробнее здесь: [url]https://stackoverflow.com/questions/79201905/what-causes-slowness-while-reading-files-in-a-multi-threaded-c-program-vs-sing[/url]
Мобильная версия