Fix LinuxEvents destructor to close all fd#15
Fix LinuxEvents destructor to close all fd#15Jens-H wants to merge 1 commit intoFastFilter:masterfrom
Conversation
|
Thanks for the PR. Can you explain this code? |
|
Certainly. It takes the last opened file descriptor (fd) assigned in the for-loop lines 41-51. Then it closes this fd and the next x-1 smaller fd, where x is the number of perf events (stored in num_events) for the LinuxEvents instance. Obviously this is a hack, as the really opened fd are not used, but guessed. |
thomasmueller
left a comment
There was a problem hiding this comment.
What about keeping the list of file descriptors in a std::vector?
Most probably a cleaner and more general solution. I should add that I am not sure how the start/end method is working with just the last fd. This is why I decided to just do a fix in the destructor and leave everything else as it is. |
Here would be how I solved running out of fds.