[poppler] UniqueFileStream and deleted files

Ihar `Philips` Filipau thephilips at gmail.com
Sun Mar 24 18:13:58 PDT 2013


On 3/25/13, Albert Astals Cid <aacid at kde.org> 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.


More information about the poppler mailing list