Use safer threading practices to prevent UDP crashes.