dsoprea / PyInotify

An efficient and elegant inotify (Linux filesystem activity monitor) library for Python. Python 2 and 3 compatible.
GNU General Public License v2.0
245 stars 73 forks source link

Documentation has unnecessary/misleading warning #15

Closed foogod closed 6 years ago

foogod commented 8 years ago

At the end of the readme, it says:

Python's VM will remain locked and all other threads in your application will cease to function until something raises an event in the directories that are being watched.

This is actually completely untrue. You are using Python's select.epoll interface to wait for events, which already handles releasing the GIL internally, so it will not block other threads while it is waiting. I have tested and confirmed that using this inotify library with other threads running works just fine, and does not block other threads or "lock the VM" in any way..

(Given this, the whole recommendation about using multiprocessing instead of threads is really unnecessary. If somebody doesn't already have other reasons to use multiprocessing, it would just add needless extra overhead in this case.)