Creating sandboxed thread API