翻译整理自:http://social.msdn.microsoft.com/Forums/vstudio/en-US/ce7799c2-52e0-4b14-b59b-30357ccb3db2/file-seek-then-read-threadsafety?forum=vcgeneral
1、fseek和fread单独使用线程安全
1、fseek和fread单独使用线程安全
fseek: "This function locks out other threads during execution and is therefore thread-safe."
http://msdn2.microsoft.com/en-us/library/75yw9bf3(VS.80).aspx
fread: "This function locks out other threads."
http://msdn2.microsoft.com/en-us/library/kt0etdcs(vs.80).aspx
2、fseek和fread联合使用需要加锁或者采用临界区
Another seek can come in between a seek-then-read operation and will need a critical section for it.
It sounds like I'll need to create a windows equivalent of pread:
int pread(handle, location, size, data*)
{
enter critical section
seek
read
leave critical section
}