in reply to Destructor Order

The first replies you have are excellent technical ways to enforce a destruct order. They will work fine for you. You may want to use OO principles to get a more direct and self-contained solution.

Since the "Thanks, stop now" command is for the serial port connection, you can make it part of that object's destructor by including it in a sub DESTROY for the COM port object.

After Compline,
Zaxo

Replies are listed 'Best First'.
Re: Re: Destructor Order
by sgifford (Prior) on Apr 03, 2004 at 08:38 UTC

    Will they really influencing the order destructors are called during global destruction? There doesn't seem to be general agreement that they will. They seem to involve holding refernces, but my Reader object is holding a reference to the COM port object, but is nonetheless destroyed before it. Maybe I'm missing something...

    Regardless, subclassing the COM port object is a clever idea. Thanks!