fsevents原语的低级接口
pyfsevents的Python项目详细描述
Introduction
pyfsevents是一个c扩展,为macosx10.5和 稍后允许使用fsevents监视文件系统事件。
pyfsevents使用回调机制:请参见Module Documentation。
Installation
python setup.py install
License
根据麻省理工学院的许可条款分发。
Requirements
Mac OS X=10.5豹
Limitations
线程不安全:cfrunloop和python线程的交互不太好 当组合在一起时:)
Module Documentation
pyfsevents使用回调机制。
它提供两个功能:
- registerfd(fd, callback[, mask])
- registerpath(path, callback)
注册要监视的对象。
注册后,应该调用listen()以等待事件。 调用被阻止:对事件触发回调。
stop()可用于停止listen()调用。stop()应该被调用 从另一条线。
有关扩展的用例,请参见examples/。
callback signatures
传递给register*函数的callback参数将在 事件。这些回调函数应该可以用两个 参数,因为listen将用两个参数调用这些函数:
对于文件描述符,registerfdcallbacks将被传递(fd,mask)参数:
- fd
file descriptor which changed and fired the callback.
- mask
the POLLIN / POLLOUT mask, similar to the select.poll module.
对于fsevents,registerpath回调将被传递(path,recursive)参数:
- path
the path where the event occurred.
- recursive
a boolean: if True, the caller should check recursively the directory tree for changes, and not only the specified directory.