Templatize newthread. Also better poll interface.