Add compatibility layer for new thread API