Allow for usage of C11 threads API as alternative to pthreads.

This includes supporting using tinycthread to emulate the C11 threads
API, which is the currently the only tested path as I don't have a
compiler/libc with C11 thread support.