vpr::Thread::self() returns NULL in the primordial thread. This is because VPR did not start it, and therefore it doesn't know what thread it is.
This works, but leads to special cases in all code that references vpr::Thread::self() (such as thread-specific data and others). A "better" solution may be to have either a global primordial thread object that we return a reference to or to be even safer (in the case of multiple unknown threads) have an auto-growing list of threads indexed by the system thread id with pre-allocated vpr::Thread objects to return.
This should make it possible remove all the special case code and allow user code to just assume that there will be a valid vpr::Thread pointer returned in all cases.