0

Suppose there is a function :

Obj* Obj::instance()
{
   static Obj obj;
   return &obj;
}

As we known that obj will be initialized when Obj::instance has been called for the first time. But what will happen if multiple thread call this function concurrently?

0

1 Answer 1

0

Thread with the highest priority gets a lock on that variable!

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.