I was asked to write a function with a static variable in it. for example:
Obviously this is not thread safe. Then I was asked to solve this problem to make it thread safe.Code:void foo(){ static int a=1; a++; }
I was told that I can use a class to wrap it. Does anybody has an idea what that is?
Do you have a better solution?