vendredi 27 décembre 2019

Shared pointer lifetime

If I dereference a shared_ptr and invoke a method on the contained object, is the shared_ptr lifetime guaranteed?

Let's say:

stream.linkInfoPtr->addTxRxBytes( txBytes, rxBytes );

Where linkInfoPtr is shared_ptr and stored in the stream object. Does it mean if linkInfoPtr would be destroyed from another thread during addTxRxBytes invocation I would face a segfault?

Aucun commentaire:

Enregistrer un commentaire