

io.open()

watch = function(tid_main){
	import fsys.watch
	import win;
	
	w = fsys.watch("\")
	
	w.onChange = function(path,flag) {  
		//写入线程共享变量
		thread.set("改变的目录",path )
		//通知主线程
		::PostThreadMessage( tid_main, 123,0,0 );
		return true;
	}
	
	w.run()
}



h = thread.create(watch, thread.getId() ) 

import win;

 
observer = function(msg){
		if(msg.message = 123){
			io.print('监控线程发来了消息,目录变化：' + thread.get("改变的目录") )
		}
}
	
win.loopMessage( observer )
