Hi,

> No. As I said in the previous mail, the file descriptor is closed for
> you, either you're using Pigment in C or in Python.

I initially thought the same as Philippe which is why I asked Loic to
clarify.

I think the problem is harder.  In my opinion, this is what's happening:

- elisa opens my folder with 1500 directories
- elisa tries, for each of those:
  - to open the fd
  - pass it to pigment

- pigment will try to asynchronously read and display the icon, until
it's done, and then it closes the fd.

If Elisa is faster than Pigment and dos'ing it with fd's, then it is
possible to reach a point where Pigment is busy reading 1000 files
asynchronously and Elisa is still trying to open more.

Several ways in which this can be addressed:

- elisa keeps track of how many fd's it has handed off to pigment that
have not been closed yet, and has an upper limit.  This is possible;
pigment has a callback for when it closes the fd.

- elisa loads the files itself asynchronously then passes the data to
pigment.  Esp. since in this case, it's loading the same icon 1500 times
over, this would make sense - Elisa can cache images it has already
loaded from disk.

Thinking about it now, the set_from_fd call to pigment is hard to use
for this reason.  Maybe in the end it's not the best interface to use.
It's also a confusing programming model in some ways to open and fd and
give away ownership.  Not sure what you think ?

Opinions ?

Thomas

Reply via email to