阅读背景:

如何在Linux中使用POSIX pthreads从一个文件写到一个缓冲区?

来源:互联网 

I want to write a program to get integers from a file and put them in a buffer using multiple threads. The buffer size is 20 and there are 100 integers. I can't use for-loop because one thread should read one integer at a time. As an example, if we are using one thread that thread must run 100 times to read the data from the file to buffer. I wrote following code to using POSIX pthreads. But the loop runs forever and it keeps reading only the first integer on the file. Can someone point me out the error, please? (The integers are not separated by a comma.Ex: 1 2 3 4 ....etc upto 100 )I want to write a program to get integers from




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: