MCPcopy Create free account
hub / github.com/Vector35/binaryninja-api / lock

Method lock

view/sharedcache/core/FileAccessorCache.cpp:77–95  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

75}
76
77std::shared_ptr<MappedFileAccessor> WeakFileAccessor::lock()
78{
79 auto sharedPtr = m_weakPtr.lock();
80 if (!sharedPtr)
81 {
82 // This will revive other weak pointers to the same shared ptr.
83 // Update the weak pointer to the newly created shared instance
84 m_weakPtr = FileAccessorCache::Global().Open(m_filePath).m_weakPtr;
85 sharedPtr = m_weakPtr.lock();
86
87 // Call the function registered with `RegisterReviveCallback`.
88 // TODO: This races if two functions cannot acquire and revive the same file at the same time.
89 // TODO: This will be called twice.
90 if (m_reviveCallback.has_value())
91 (*m_reviveCallback)(*sharedPtr);
92 }
93
94 return sharedPtr;
95}

Callers 15

ViewSpecificStateForIdFunction · 0.45
WritePointerMethod · 0.45
ReadCStringMethod · 0.45
ReadUInt8Method · 0.45
ReadInt8Method · 0.45
ReadUInt16Method · 0.45
ReadInt16Method · 0.45
ReadUInt32Method · 0.45
ReadInt32Method · 0.45
ReadUInt64Method · 0.45
ReadInt64Method · 0.45
ReadBufferMethod · 0.45

Calls 1

OpenMethod · 0.45

Tested by

no test coverage detected