Code cleanup for callback hangings in Linux