Implement custom ThreadDevice to allow context sharing