Hi dev! I have two questions about the Context base implementation. 1. Ownership of the `finisher` aka `onfinish` object. C_GatherBase has this method >>>>>>> void delete_me() { if (onfinish) { onfinish->complete(result); _onfinish_ = 0; } delete this; } ... ~C_GatherBase() { mydout(cct,10) << "C_GatherBase " << this << ".delete" << dendl; } <<<<<<< And C_GatherBuliderBase has this >>>>>>> ~C_GatherBuilderBase() { if (c_gather) { ceph_assert(activated); // Don't forget to activate your C_Gather! } else { delete finisher; } } <<<<<<< We can see that the GatherBuilder will delete the finisher unless c_gather was created, which implies that c_gather should take ownership of the finisher instance. However, c_gather will only call `complete` on the finisher instance and won’t destruct it. Is this intentional? I’d expect that C_Gather would either destruct the finisher immediately after calling complete, or in its own destructor (which would require to avoid setting the finisher to zero post calling complete) 2. Mysterious activation requirement for subs queries C_GatherBuilderBase has this >>>> int num_subs_created() { ceph_assert(!activated); if (c_gather == NULL) return 0; return c_gather->get_sub_created_count(); } int num_subs_remaining() { ceph_assert(!activated); if (c_gather == NULL) return 0; return c_gather->get_sub_existing_count(); } <<<< I’m puzzled with the assert in these methods, what’s the reason for it? I’d like to call these post activation and I don’t see anything in the C_GatherBase that would prevent that. |
_______________________________________________ Dev mailing list -- dev@xxxxxxx To unsubscribe send an email to dev-leave@xxxxxxx