Skip to content

Runtime event for Monitor.Wait #94264

@verdie-g

Description

@verdie-g

Originally posted by verdie-g August 17, 2023 #90740
I recently got a latency spikes issue in my application because the async API of a library was actually waiting on a ManualResetEventSlim.Wait that would cause thread starvation. Now I would like to collect events about any thread that starts waiting. I can collect the contention event, the task waits, but it seems like there is no events emitted in ManualResetEventSlim. Looking at the code ManualResetEventSlim uses Monitor.Wait so I've tried looking for an event there but couldn't find any. Any idea what I could do to easily detect blocked threads?

What do you think of having a new event for Monitor.Wait?

Related issue where I suggested a dedicated event for synchronous task waits: #63016.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-System.ThreadingquestionAnswer questions and provide assistance, not an issue with source code or documentation.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions