When I was reading seastar source code, I noticed that there is a union structure called tx_side
which has only one member. Is this some hack to deal with a certain problem?
FYI, I paste the tx_side
structure below:
union tx_side {
tx_side() {}
~tx_side() {}
void init() { new (&a) aa; }
struct aa {
std::deque<work_item*> pending_fifo;
} a;
} _tx;
union
instead ofstruct
is one or more of the differences between the two. It's a pretty obscure technique so unless the original author of that code comes along I'm not sure somebody can give you an authoritative answer which problem they're hoping to solve with this (if any). – Shults_tx
is not used only defined. It would maybe be helpful to see an example of actual usage of this variable. – Estafettedeque
is destroyed? – Foremost