Modify the adapter example to perform write operations in a worker thread