Skip to content

cothread should not unconditionally delete the EPICS context #69

Description

@AlexanderWells-diamond

Currently cothread.catools registers an atexit handler which unconditionally calls cadef.ca_context_destroy(). This will destroy the context regardless of whether cothread was the one who created it. This is usually not a problem, but if cothread is used alongside aioca in the same thread then it is possible for aioca to create the EPICS context, for cothread to then delete it, and then aioca to also try and delete it. This causes a segfault.

cothread should keep track of whether it was the one who created the context - the return code for ca_context_create should tell us that. If we created the context we should destroy it inside the atexit handler, otherwise leave it alone.

aioca has added this mechanism in PR #36 and modified it in PR #51

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