Implement scoped threading and channels.