Implement getcontext and setcontext