MCPcopy Create free account
hub / github.com/anjo76/angelscript / Get

Method Get

sdk/add_on/weakref/weakref.cpp:185–204  ·  view source on GitHub ↗

AngelScript: used as '@obj = ref.get();'

Source from the content-addressed store, hash-verified

183
184// AngelScript: used as '@obj = ref.get();'
185void *CScriptWeakRef::Get() const
186{
187 // If we hold a null handle, then just return null
188 if( m_ref == 0 || m_weakRefFlag == 0 )
189 return 0;
190
191 // Lock on the shared bool, so we can be certain it won't be changed to true
192 // between the inspection of the flag and the increase of the ref count in the
193 // owning object.
194 m_weakRefFlag->Lock();
195 if( !m_weakRefFlag->Get() )
196 {
197 m_type->GetEngine()->AddRefScriptObject(m_ref, m_type->GetSubType());
198 m_weakRefFlag->Unlock();
199 return m_ref;
200 }
201 m_weakRefFlag->Unlock();
202
203 return 0;
204}
205
206bool CScriptWeakRef::Equals(void *ref) const
207{

Callers 1

Calls 5

LockMethod · 0.80
AddRefScriptObjectMethod · 0.80
UnlockMethod · 0.80
GetEngineMethod · 0.45
GetSubTypeMethod · 0.45

Tested by

no test coverage detected