Skip to content

Unsolicited code review: Mixing OS-native thread functions with Go's runtime is probably dangerous #2

@hillu

Description

@hillu

I was curious why there's any need for dealing with native threads and had a closer look. While running NtQueryObject that might hang on its own thread is a clever workaround, I am afraid that the Go runtime may behave in unexpected ways when a thread that had been subscribed to a channel suddenly disappears because it has been killed using kernel32.TerminateThread, without the runtime's knowledge.

I would try encapsulating only those NtQueryObject calls that might fail (because it has one of the four magic access attributes) in individual, separate threads.

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