A thread can have a pointer to a CSpace defined in thread local storage. This is useful in various cases where a CSpace is passed implicily into various functions or language constructs. For example it is used by $new to allocate objects in a CSpace.
CSpace* GetThreadPtr<CSpace>()
Get the pointer to the CSpace in thread local storage, or returns nullptr if none has been set.
void SetThreadPtr(CSpace* cspace)
Set the pointer to the CSpace in thread local storage.