New API to set default thread attributes

Second draft.