On 3/25/13, Albert Astals Cid <[email protected]> wrote:
> El Diumenge, 24 de març de 2013, a les 14:03:49, Ihar `Philips` Filipau va
> escriure:
>>
>> If you want to use them in the MT context, you would have to maintain
>> an offset variable per reader object, and update the offset variable
>> after every read operation (since pread() doesn't update the filedes'
>> internal offset). And code somewhere to actually close the file, after
>> all the reader threads have terminated.
>
> Can you have two reads from different threads simulatenously over the same
> fd  with pread?
>

Yes. That is one of the uses of the pread(). There should be no
problems, as long as the file is only read and is not written into.

It was introduced long time ago as a non-racing, atomic analogue of
lseek()+read() (and lseek()+write() for pwrite()), because fork()ed
processes have the same problem with the shared file descriptors.
_______________________________________________
poppler mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/poppler

Reply via email to