Deal with thread communication.