Skip to content

release GIL for computationally expensive C calls #172

@fommil

Description

@fommil

Thank you for maintaining this library, I am considering using it in my https://github.com/fommil/luddcam capture app to find star centers for guiding and to avoid having to pass fits files back and forth to astrometry's solve-field (by writing out .axy files).

My app runs realtime on low powered (raspberry pi 4b) devices and it has quite a few threads in play to do various things.

Unfortunately it looks like the calls to the sep C library are not flagged to release the Global Interpreter Lock (GIL) so while the C code is doing its thing, the rest of the python code is blocked from progressing.

Is there any chance you could please do the relevant save/restore thread dance so that it becomes a non-blocking api? You're read only of the input array so this should be pretty safe. There's of course the a risk that the user mutates the data array in another thread, but that sounds like it was always asking for trouble.

Note that I made a similar request of fitsio over at esheldon/fitsio#476 and their WIP implementation is a really excellent tutorial on how to release the GIL from native library code.

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