0

Imagine the following:

// SECTION A
MyClass* object = new MyClass();
std::shared_ptr<void> sharedObject;

// SECTION B (sharedObject is empty)
sharedObject.reset(object);

Is section B lock-free for an empty sharedObject? Or does it depend of the implementation?

Jorengarenar
  • 2,705
  • 5
  • 23
  • 60

1 Answers1

1

This depends on implementation.

Some pointers:

  1. Overhead and implementation of using shared_ptr
  2. Linking pthread disables lock-free shared_ptr implementation
ypnos
  • 50,202
  • 14
  • 95
  • 141