Thread dispatch library for manycore, excerpted and extended from libtorque