Move pollserver loop into a thread