pyinotify.ThreadedNotifier
呼び出し元の EventHandlerの名前を取得する方法を考えていました。
pyinotify.ThreadedNotifier
"Thread-1"、"Thread-2" などの名前が自動的に付けられます。
import pyinotify
class EventHandler(pyinotify.ProcessEvent):
def process_default(self, event):
print "TRIGGER:", event.pathname
# Thread #1
wm1 = pyinotify.WatchManager()
notifier1 = pyinotify.ThreadedNotifier(wm1, EventHandler())
notifier1.start()
print notifier1.getName()
wm1.add_watch('/tmp/a', pyinotify.ALL_EVENTS, rec=True, auto_add=True)
# Thread #2
wm2 = pyinotify.WatchManager()
notifier2 = pyinotify.ThreadedNotifier(wm2, EventHandler())
notifier2.start()
print notifier2.getName()
wm2.add_watch('/tmp/b', pyinotify.ALL_EVENTS, rec=False, auto_add=False)
関数を使用して通知者の名前を取得できますが、どの通知getName()
者が my を呼び出したのかを調べる方法がわかりませんEventHandler()
。
調べる方法はありますか?