|
Celeritas 0.7.0-dev.555+develop.5c5a8f0a7
|
Clear a slot's cached pointers when its hit processor is destroyed. More...
Public Member Functions | |
| void | operator() (HitProcessor *processor) const |
Public Attributes | |
| std::weak_ptr< ProcessorSlot > | weak_slot |
Clear a slot's cached pointers when its hit processor is destroyed.
The references between the slot and the processor are cyclic and deliberately non-owning in both directions:
GeantSd --(shared)--> ProcessorSlot --(weak + raw cache)--> HitProcessor
^ |
+--(weak, via this deleter)----------+
LocalTransporter --(shared, with this deleter)--> HitProcessor
The thread-local transporter shares ownership of the processor, and GeantSd owns the slot. Since the cross references are weak, either side may be destroyed first:
make_local_processor call recreates the processor instead of returning a dangling pointer;GeantSd (and thus the slot) is destroyed first, locking the weak pointer fails and only the processor is deleted.