Added calls/adapters for thread management.

It's untested.