make send-event thread-safe
more tinkering with writer thread
little tweak