share memory caused problem
2017-10-27 本文已影响0人
zzjack
using django wrote some view functions.
class resMsg(View):
SUCCEES = "success"
GETMSG = "only accept post method"
def get(self):
return Httpresponse(self.GETMSG)
class one(resMsg):
def post(self):
return Httpresponse(self.SUCCEES)
class two(resMsg):
def post(self):
return Httpresponse(self.SUCCEES)
class thee(resMsg):
def post(self):
self.SUCCEES = "i am three and success"
return Httpresponse(self.SUCCEES)
then,wrote a script to request one two threee urls,i found the result like that:
i am three and success
i am three and success
i am three and success
why?because the memory was shared by one two three.And,two changed the memory.