imported John Tsiombikas's c11threads :)