Skip to content

not thread-safe Synchronous reading works fine, but moving the .read() call into a thread causes crashes. #3

Open

Description

@simonfeile
from pathlib import Path
import asyncio
from maccor_utility.read import MaccorDataRawFile

cwd = Path(__file__).resolve()
path2file = cwd.parents[1] / "test_data" / "231004_test_data_raw.024"

# ✅ synchronous usage works
file = MaccorDataRawFile(path2file)
file.read()

# ❌ but fails when called in a thread
async def read_in_thread(file):
    return await asyncio.to_thread(file.read)

file = asyncio.run(read_in_thread(file))
print(file)

GIves the following error:

OSError: [WinError 250477278] Windows Error 0xeedfade

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions