seb-m / pyinotify

Monitoring filesystems events with inotify on Linux.
http://github.com/seb-m/pyinotify/wiki
MIT License
2.29k stars 379 forks source link

Shouldn't call close on already closed fd... #176

Open giannitedesco opened 5 years ago

giannitedesco commented 5 years ago

If WatchManager.close() is called twice then bad things can happen :) Also if WatchManager.close() is called then Notifier.stop() the same thing can happen. Basically, there needs to be a well defined lifetime/ownership for the fd otherwise we can start randomly closing the fd's belonging to other objects which don't expect it.

giannitedesco commented 5 years ago

Maybe context managers would be nice too, that'd make it clear.