Make serial read asynchronous and event driven. Change write thread to block until needed.