modify the example for inotify
add lock for tas and ttas