MCPcopy Create free account
hub / github.com/buke/quickjs-go / takeClassObjectIdentity

Method takeClassObjectIdentity

runtime.go:1327–1350  ·  view source on GitHub ↗
(objectID int32)

Source from the content-addressed store, hash-verified

1325}
1326
1327func (r *Runtime) takeClassObjectIdentity(objectID int32) (classObjectIdentity, bool) {
1328 if r == nil || objectID == 0 {
1329 return classObjectIdentity{}, false
1330 }
1331 v, ok := r.classObjectRegistry.LoadAndDelete(objectID)
1332 if !ok {
1333 return classObjectIdentity{}, false
1334 }
1335 identity, ok := v.(classObjectIdentity)
1336 if !ok {
1337 return classObjectIdentity{}, false
1338 }
1339 if identity.contextID == 0 || identity.handleID <= 0 {
1340 return classObjectIdentity{}, false
1341 }
1342
1343 if bucketValue, ok := r.classObjectIDsByCtx.Load(identity.contextID); ok {
1344 if bucket, ok := bucketValue.(*sync.Map); ok {
1345 bucket.Delete(objectID)
1346 }
1347 }
1348
1349 return identity, true
1350}
1351
1352func (r *Runtime) cleanupClassObjectIdentitiesByContext(contextID uint64) {
1353 if r == nil || contextID == 0 {

Calls 2

LoadMethod · 0.80
DeleteMethod · 0.45