2009年1月6日星期二

Static variable, the synchronism of static method is changed

Example is variable / the method can pass Lock, moniter will make sure a hour has Cheng of a line to be able to be entered only, so the static state is variable, static method, how to assure?
Static field is locked up kind

Lock(typeof(typename) )
{

}

As to the method, I do not know synchronous what you want. I just want to assure 1 kind method of all static state and variable are in a certain hour has Cheng of a line to be able to be visited only.
Resemble Lock(obj) , - - Obj is an object example
The variable in the city that can make sure other line Cheng can no more visit it / the method is same

没有评论: