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,523
  • 4
  • 17
  • 38

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
  • 48,098
  • 14
  • 91
  • 140