base: quickfix race in thread-context allocation

Just for documentation - please do not merge.

Note, the base and base-foc variants are similar in most places.

Related to #1024.