[server][ArmBase] Add a new method: synchronizeThreadExit().

The purpose of this patch is to clean up the destructor of
subclasses by aggregating commonly used code.