mosquitto: only write to socket pair in threaded mode
Otherwise it is possible to write to the socket pair when there is no consumer resulting in the buffer growing indefinitely. This issue manifests itself when an external event loop is used together with mosquitto_loop_read/mosquitto_loop_write/mosquitto_loop_misc instead of using mosquitto_loop, mosquitto_loop_forever or threaded mode with mosquitto_loop_start/mosquitto_loop_stop