reference - C++ object termination notification -


In the C ++ program, my two references are numbered objects: King and Heirs . The heir has to be blocked until the king is destroyed. The king is a reference item that will be destroyed when its reference number becomes zero. If the warrior is in the context of the king, then the king's reference number will never be at zero, how can he be the heir block until the king is destroyed?

"post-text" itemprop = "text">

In the context of non-owners (or "weak").

To wait till the death of the king, you can use a mute x until the king dies and the heir block is waiting to leave the king. / P>

If you have to wait for many succession and the heir has been given some order, you can get a "heir selector" object which keeps track of the heirs list and keeps track of his predecessor , And when the king releases Mutex, it will give ownership to the next heir in that list.


Comments