'''示例9: 装饰器带类参数，并分拆公共类到其他py文件中
同时演示了对一个函数应用多个装饰器'''
from practice import *

class example:
	@lockhelper(mylocker)
	def myfunc(self):
		print "myfunc() called."
	@lockhelper(mylocker)
	@lockhelper(lockerex)
	def myfunc2(self, a, b):
		print "myfunc2() called."
		return a + b
if __name__ == '__main__':
	a = example()
	a.myfunc();print
	print a.myfunc();print
	print a.myfunc2(1, 2)
	print a.myfunc2(3, 4)
#before myfunc called.
#mylocker.acquire() called.
#myfunc() called.
#mylocker.unlock() called.
#before myfunc called.
